Link to home
Start Free TrialLog in
Avatar of LuckyLucks
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 ();}
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of LuckyLucks
LuckyLucks

ASKER

No, the SYSIBM.SYSCOLUMNS shows the database field's type as a CHAR with length 9.
oops sorry, u r correct LearnedOne.