|
|
 |
| 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.
|
 |

July 14th, 2009, 10:36 AM
|
|
Friend of Wrox
|
|
Join Date: Jul 2003
Location: , , .
Posts: 120
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
'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
|

July 16th, 2009, 10:37 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,000
Thanks: 5
Thanked 37 Times in 36 Posts
|
|
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.
================================================== =========
|

July 16th, 2009, 10:56 AM
|
|
Friend of Wrox
|
|
Join Date: Jul 2003
Location: , , .
Posts: 120
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
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
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |