Hi, i get the following error
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in FROM clause.
this is my code
import java.sql.*;
public class DetOrderNum{
public static void main(String[] args){
Connection con=null;
ResultSet rs=null;
Statement stmt=null;
int pkey=0;
String itemn="jin";
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:MY-PIZZA","","");
String q="select order_num from Order where recev_fname='"+itemn+"'"
stmt=con.createStatement();
// System.out.println("stme ok");
rs=stmt.executeQuery(q);
//System.out.println("q exe");
if(rs !=null){
rs.next();
pkey=rs.getInt(1);
}
}catch(SQLException e){
System.out.println(e);
}catch(ClassNotFoundException ee){
}finally{
try{
if(rs !=null){
rs.close();
rs=null;
}
if(stmt !=null){
stmt.close();
stmt=null;
}
if(con !=null){
con.close();
con=null;
}
}catch(SQLException e){}
}
System.out.println(pkey);
}
}
oder_num is auto increment field.fname is a text type.
can anyone tell me what is the mistake?