Solved

SQLSTATE 22005

Posted on 2006-11-20
3
1,884 Views
Last Modified: 2012-08-14
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 ();}
0
Comment
Question by:LuckyLucks
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
ID: 17986529
22005 - error in assignment

Sounds like you are trying to pass in a varchar where a numeric value is expected.

Bob
0
 

Author Comment

by:LuckyLucks
ID: 17987101
No, the SYSIBM.SYSCOLUMNS shows the database field's type as a CHAR with length 9.
0
 

Author Comment

by:LuckyLucks
ID: 17987369
oops sorry, u r correct LearnedOne.
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question