Hi!,
when im trying to execute following code.i get this error.can any one help me to make it correct.
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.
at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcStatement.execute(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery(Unknown Source)
at SelectApp.main(SelectApp.java:18)
this is my code.
import java.sql.*;
public class SelectApp {
public static void main(String args[]) {
String ss="Italiantomato";
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch( Exception e ) {
System.out.println("Failed to load mSQL driver.");
return;
}
try {
Connection con = DriverManager.getConnection("jdbc:odbc:test1","","");
Statement select = con.createStatement();
ResultSet result = select.executeQuery("select price from Item_size where item_code = '3' and size = 's' ");
System.out.println("Got results:");
while(result.next()) { // process results one row at a time
Long key = result.getLong(1);
System.out.println("key = " + key);
}
select.close();
con.close();
}
catch( Exception e ) {
e.printStackTrace();
}
}
}