Syntax Error
ok I have searched for a good hour and found nothing that pertains directly to my problem so I need some help...Here is my populate method that connects to an Access DB and builds the resultset...Everything looks right however I keep getting this error when I run my test program...
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in FROM clause.
at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6998)
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7155)
at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:3151)
at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:378)
at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery(JdbcOdbcStatement.java:284)
at orderSystem.Order.populate(Order.java:47)
at orderSystem.TestOrderInfo.main(TestOrderInfo.java:22)
any ideas Thanks ahead of time for any feedback...
publicboolean populate ()
{
boolean populated =false;
Connection con =null;
try
{
//register the JDBC driver
DriverManager.registerDriver(new sun.jdbc.odbc.JdbcOdbcDriver());
//connect to a database
con = DriverManager.getConnection("jdbc:odbc:Soundstream");
//execute a SQL statement
Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
//show the results
ResultSet rs = stmt.executeQuery("SELECT * FROM Order WHERE orderID =" + orderID);[b]<<<<<<<<ERROR OCCURS HERE[/b]
if (rs.last())//determine if there is a record returned by sql execution
{
shippingAndHandling = rs.getDouble(2);
tax = rs.getDouble(3);
subtotal = rs.getDouble(4);
populated =true;
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
finally
{
if (con !=null)
{
try
{
con.close();
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
}
return populated;
}
>

