Solved

SQLSTATE 22005

Posted on 2006-11-20
3
1,876 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
  • 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
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…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

758 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now