Hello, All:
I'm building a new application to call an Informix stored procedure, which has an output parameter. I'm using Informix Net Provider installed along with IBM Informix Client-SDK2.90.
My stored procedure is:
create procedure irp001_p_onepara(i_id int)
returning char(10);
define v_name char(10);
select emp_name into v_name from pub_t_employee where emp_id = i_id;
return v_name;
end procedure
My Net code is like:
........
IfxConnection conn = getConnection(); //Get connection. No probelm here
IfxCommand command = new IfxCommand();
command.CommandType = CommandType.StoredProcedure;
command.Connection = conn;
command.CommandText = "irp001_p_onepara";
IfxCommandBuilder.DeriveParameters(command); //Get parameters
foreach (IfxParameter item in command.Parameters)
{
if (item.ParameterName.Equals("i_id", StringComparison.OrdinalIgnoreCase))
item.Value = 4;
}
IDataReader dr = command.ExecuteReader(CommandBehavior.SingleRow); //An exception occurs
...........
When executing, the following error occurs on the last line:
IBM.Data.Informix.IfxException: ERROR
HY000 http://Informix .NET providerInformix
Routine (irp001_p_onepara) can not be resolved.
at IBM.Data.Informix.IfxConnection.HandleError(IntPtr hHandle, SQL_HANDLE hTy
pe, RETCODE retcode)
at IBM.Data.Informix.IfxCommand.ExecuteReaderObject(CommandBehavior behavior,
String method)
at IBM.Data.Informix.IfxCommand.ExecuteReader(CommandBehavior behavior)
at test.informix.InformixTest.TestSP() in D:\My Documents\Visual Studio 2005\
Projects\ConsoleApplication2\ConsoleApplication2\InformixTest.cs:line 73
(Exception under Informix Client-SDK3.00)
System.NullReferenceException: Object reference not set to an instance of an obj
ect.
at IBM.Data.Informix.IfxParameter.GetParameterValue()
at IBM.Data.Informix.IfxParameter.Bind(IntPtr stmt, IfxCommand parent, Int16
ordinal, CNativeBuffer buffer, CNativeBuffer intbuffer)
at IBM.Data.Informix.IfxCommand.ExecuteReaderObject(CommandBehavior behavior,
String method)
at IBM.Data.Informix.IfxCommand.ExecuteReader(CommandBehavior behavior)
at test.informix.InformixTest.TestSP() in D:\Frank_Work\APBNet\ConsoleApplica
tion2\ConsoleApplication2\InformixTest.cs:line 72
(Exception under Informix Client-SDK2.90)
Any one can help me? Thanks.