Solved

SQLSTATE 22005

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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

705 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