Dear gurus, I am having trouble in converting an object to an integer. The object actually is an item from a Jcombobox and i need to compare it against a field that has been declared as a number in the database. I received the following error: "java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression." I have tried casting it to an integer but to no avail. Any help would be really appreciated. Thanks!
Nathanael Ulrick
Greenhorn
Joined: Jul 17, 2001
Posts: 22
posted
0
Let's see your query, and the relevant section of code where this is happening.
Marcos Maia
Ranch Hand
Joined: Jan 06, 2001
Posts: 977
posted
0
As long as you did not post any code I�m gonna make somme assumptions: lets supose you have a String object and you�re sure that it has an integer value you coul�d use ex(suppose you�ve recover the String value from your combo): String s = "244"; Integer integer = new Integer(s); int i = integer.intValue(); regards.
String s = "244"; int i = Integer.parseInt(s); //if it is an integer value Double d = Double.parseDouble(s); //if it needs precision Long....etc.//for large integer values Jamie
Ben Koh
Greenhorn
Joined: Aug 06, 2001
Posts: 7
posted
0
Thanks for your help guys, I think I've got it. Cheers!