adi501
07-15-2008, 11:48 PM
Hi.
I have written the following Sql statement in my java code.
String str = "SELECT ZipCode,State FROM zipcodes WHERE City = '+city+' AND State = '+state+'";
rsZipCodes = oStatement.executeQuery(str);
Now when i am running the above statement in my query browser i am getting the following sql statement.
SELECT ZipCode,State FROM zipcodes WHERE City ='+city+' AND State = '+state+';
In the above statement the city and state value is passed from the user.
But i need the below Sql statement to get the correct output.
SELECT ZipCode,State FROM zipcodes WHERE City = 'TAMPA' AND State ='FL';
Finally my problem is with dealing with the double codes and single codes in the WHERE clause.
Anybody know how to deal with this.
Thanks in Advance.
I have written the following Sql statement in my java code.
String str = "SELECT ZipCode,State FROM zipcodes WHERE City = '+city+' AND State = '+state+'";
rsZipCodes = oStatement.executeQuery(str);
Now when i am running the above statement in my query browser i am getting the following sql statement.
SELECT ZipCode,State FROM zipcodes WHERE City ='+city+' AND State = '+state+';
In the above statement the city and state value is passed from the user.
But i need the below Sql statement to get the correct output.
SELECT ZipCode,State FROM zipcodes WHERE City = 'TAMPA' AND State ='FL';
Finally my problem is with dealing with the double codes and single codes in the WHERE clause.
Anybody know how to deal with this.
Thanks in Advance.