• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with null field

 
Jennifer Sohl
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi. I am using VA for JAVA 3.5.3 to develop applications.
We are connection to a DB2(V3R2) database using JDBC. The application is vendor maintenance. The GUI contains a field called Minimum Order. We have this field described as a decimal field, ALWNULL in our DDS file on the 400. Here is the code that updates the file on the 400:

A user will assign roughly 5 or 6 vendor numbers a day. The problem is, 1 out of 5 of these vendor numbers, somehow comes up with the Minimum order field value being NULL.
How is this happening? If you look at the above code, I believe I am telling it if the field is null, or nothing is keyed into this field, put a zero value in it.
With this field value being NULL in the file, the user cannot use this vendor number they assigned for other programs on the AS/400.
If anyone can help, it would be GREATLY appreciated!!
 
Chantal Ackermann
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
at the first glance, I think your code is ok.
what you could/should do is, save the getMinord().getText() value in a variable. this way you'll have to call the method only once (saves time) and you'll be sure, that the value you checked is the one you'll be inserting.
another question: if this field must not be null, why is the database allowing null, anyway? thats messy. the field should be NOT NULL in the table. noone would be able insert a NULL value and the data would remain consistent.
Ok, I'm seeing some more: if the value you're checking is null, you insert "0". that's a java string. is the field in the database able to hold strings? i don't think so, as the minimum value is likely to be an int. check, if you're really inserting the int 0 ant not the string "0".
chantal
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic