Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

not-null-field issue

Status
Not open for further replies.

newbieAl

Programmer
Sep 10, 2007
21
US
I have a C# application that calls a MySQL procedure and writes data to the db. All of the fields get populated properly but for the ID field, which is my PK field. It populates the field with an empty string instead of the value. the ID field is a varchar field.

When I try a direct insert through the MySql Query Browser, it populates the field correctly, but when using the C# code/appl. the above issue occurs.

What could the issue be?
 
Maybe something in your C# code is having a problem. Check that the query is a getting a correct value for the key.



----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
I did check it and in my code the variable is defined as string and I am passing a string value.
 
Try printing out the query after you have built it, so you know it looks right. Make sure the variable for the PK field value actually has something in it at the point where you use it in the query.




----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Well i'm sure there is a function in C# to print variables out to where you can see them, use that.



----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top