LuckyLucks
asked on
SQLSTATE 22005
HI EE:
I am experiencing a wierd error SQL State 22005 when executing a DataReader and passing it one input parameter. I have checked the expected database type for this input parameter and the type specified in the parameter preparation in the .NET code. They are both the same i.e char with length 9.
However, if I input a number like 123 etc this will not raise the above exception BUT raises it for a alphabetic value like 'ab'. What is the reason this is so?
CODE:
DB2Command cmd = new DB2Command (SQL, db2Conn);
cmd.Parameters.Add (cr.Name, DB2Type, length, cr.Name);
cmd.Parameters[0].Value = userInput;
try
{
DB2DataReader rs = cmd.ExecuteReader ();
rs.Close ();
}
catch (Exception ex){throw ex; }
finally{db2Conn.Close ();}
I am experiencing a wierd error SQL State 22005 when executing a DataReader and passing it one input parameter. I have checked the expected database type for this input parameter and the type specified in the parameter preparation in the .NET code. They are both the same i.e char with length 9.
However, if I input a number like 123 etc this will not raise the above exception BUT raises it for a alphabetic value like 'ab'. What is the reason this is so?
CODE:
DB2Command cmd = new DB2Command (SQL, db2Conn);
cmd.Parameters.Add (cr.Name, DB2Type, length, cr.Name);
cmd.Parameters[0].Value = userInput;
try
{
DB2DataReader rs = cmd.ExecuteReader ();
rs.Close ();
}
catch (Exception ex){throw ex; }
finally{db2Conn.Close ();}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
oops sorry, u r correct LearnedOne.
ASKER