代码:
PreparedStatement stmt_customer = conn.prepareStatement("select level from customer where m_id = ?");
stmt_customer.setString(1, customerID);
rset_customer = stmt_customer.executeQuery();
if(rset_customer.next())
{
.......
}错误提示:
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] LEVEL 子句中包含一个保留字、拼写错误或丢失的参数,或标点符号不正确。而且没有进入if语句请问是哪里出错了啊?
PreparedStatement stmt_customer = conn.prepareStatement("select level from customer where m_id = ?");
stmt_customer.setString(1, customerID);
rset_customer = stmt_customer.executeQuery();
if(rset_customer.next())
{
.......
}错误提示:
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] LEVEL 子句中包含一个保留字、拼写错误或丢失的参数,或标点符号不正确。而且没有进入if语句请问是哪里出错了啊?
比如你不能在SQL Server里建一个叫user的表
我试了一下,发现sqlserver表中不能用level做列名
改成m_level后就没事了。但,stmt_customer.setString(1, customerID);似乎还有问题
得到的sql语句中的 m_id = "乱码"这个还要再看看 PreparedStatement 的用法
不知楼下的高人能否指点 PreparedStatement 的注意问题
谢谢~~