Hi. If a user keys in a postal code that is not in the table, I want an error message to come back stating this. My problem is that I can't seem to figure out how to tell if my select statement didn't find anything. Is there a method I can use that is sort of like a getRowCount? I've tried comparing to null, but that doesn't work. I've also tried comparing the row to zero, but that doesn't get the job done either. Any help is appreciated!! Thanks in advance!
Jennifer If all you want to know is if the number they enter is in the table then try this: SELECT count(*) FROM table WHERE zipcodeColumn = 'userValue' That should just return an integer in the count field that you can check to see if it greater than zero. Either way you do it you should be getting a ResultSet back then just use next to see if there is a row or not. But I know you know that so I might not be understanding your question correctly. Another option would be to turn it into an update and not really do anything in the update: UPDATE table SET zipcodeColumn = 'userValue' WHERE zipcodeColumn = 'userValue' That should still return an update number even if it really doesn't do anything - but that might be kind of dangerous too if the user does something strange. Hope that helps a little bit Dave
Jennifer, If i were u and understood ur problem(U want to check whether the entered number which is a zipcode is valid or not) use the zipcode as a type table and cache it then i dont have to go to database everytime to check it, if it does exist and then only goahead and do rest of the processing this way i will not be tying up the precious system resources. Sorry for not giving a quick answer but for quick fix Bill suggestion is good Kareem