|
-
May 13th, 2005, 07:17 AM
#1
ive done something stupid!
Hi and greetings!
Im trying to learn a bit of SQl through jdbc. at present i have a little problem concerning constructing a SELECT statement including a variable. salary which is declared as an integer.
when i use this statement
String thisQuery = "SELECT* FROM EmployeeTable WHERE EmployeeSalary > 25000";
everything works well and i get the expected output. However when i use this statement: -
String thisQuery = "SELECT* FROM EmployeeTable WHERE EmployeeSalary > '"+salary+"'";
i get a data type mismatch error namely
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.
Clearly im doing something totally wrong building my string but i cant see for the life of me what is is.
Could some kind soul please kick me in theright direction
ta
John
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|