p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > .NET > Other .NET > General .NET
I forgot my password Register Now
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.

Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 14th, 2009, 10:36 AM
Friend of Wrox
Points: 634, Level: 9
Points: 634, Level: 9 Points: 634, Level: 9 Points: 634, Level: 9
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2003
Location: , , .
Posts: 120
Thanks: 1
Thanked 0 Times in 0 Posts
Default 'Unspecified error' on ExecuteNonQuery function in ORACLE

Hello,

I am trying to execute the function in ORACLE database from my .NET code, but I am getting this 'Unspecified error' error message by some reason. This is my function in the database:
Code:
create or replace FUNCTION eqn( a NUMBER, b NUMBER ) RETURN NUMBER AS
 BEGIN
    IF a = b THEN
       RETURN -1;
    ELSE
       RETURN 0;
    END IF;
 END;
And this is the function in my .NET code which is trying to execute this function:
To simplefy the code, I've entered rendom values into the code
Code:
public object ExecuteFunctionTwoParameters()
{
OleDbCommand oracleCommand;
string stringReturn = null;
string param1_Name = "a";
string param2_Name = "b";
 
oracleCommand = newOleDbCommand();
oracleCommand.Connection = currentOLEDBConnection;
oracleCommand.CommandText = "EQN";
oracleCommand.CommandType = CommandType.StoredProcedure;
 
oracleCommand.Parameters.AddWithValue(param1_Name, 1);
oracleCommand.Parameters.AddWithValue(param2_Name, 2);
OleDbParameter retval = newOleDbParameter("return_value", OleDbType.Numeric);
retval.Direction = ParameterDirection.ReturnValue;
oracleCommand.Parameters.Add(retval);
 
try{
sErrorMessage = "";
oracleCommand.ExecuteNonQuery();
stringReturn = oracleCommand.Parameters["return_value"].Value.ToString();
return (object)stringReturn;
} //End trycatch (System.Data.OleDb.OleDbException e)
{
sErrorMessage = e.Message;
stringReturn = "ERROR";
return (object)stringReturn;
}
finally{
//do the clean up:oracleCommand.Dispose();
oracleCommand = null;
}
} 
What am I doing wrong?
Could you help me with this problem, please?
Thanks in advance,
Dmitriy
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old July 16th, 2009, 10:37 AM
Friend of Wrox
Points: 6,570, Level: 34
Points: 6,570, Level: 34 Points: 6,570, Level: 34 Points: 6,570, Level: 34
Activity: 43%
Activity: 43% Activity: 43% Activity: 43%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,000
Thanks: 5
Thanked 37 Times in 36 Posts
Send a message via MSN to gbianchi
Default

I'm not an expert on Oracle, but you are calling a function like it was a Store Procedure??

can you really do that??
__________________
HTH

Gonzalo


================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the
proof.
================================================== =========
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #3 (permalink)  
Old July 16th, 2009, 10:56 AM
Friend of Wrox
Points: 634, Level: 9
Points: 634, Level: 9 Points: 634, Level: 9 Points: 634, Level: 9
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2003
Location: , , .
Posts: 120
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Hi,
I have found the source of my error. The procedure name was not explicitly pointed to the correct database schema.
It was like:
Code:
oracleCommand.CommandText = "EQN";


It supposes to be like:
Code:
oracleCommand.CommandText = "SCHEMA_NAME.EQN"


Thanks anyway for the reply.
-Dmitriy
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Unspecified error mahesh_82 ADO.NET 1 January 10th, 2007 06:24 AM
Unspecified Error. lam_lvl ADO.NET 4 December 22nd, 2006 02:47 PM
Unspecified Error??? werD420 Classic ASP Databases 2 April 10th, 2005 02:00 PM
unspecified error Meterman Classic ASP Databases 1 July 13th, 2004 11:19 AM
Error trying to call Oracle function in VB.NET lou_1 Pro VB.NET 2002/2003 0 January 13th, 2004 06:42 PM



All times are GMT -4. The time now is 04:28 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc