int sixteen = 16;
String full="%"+sixteen+"%";
conn = PervasiveUtil.loadDriver();
stmt = conn.prepareStatement("SELECT BKAR_INV_SONUM "
+ " FROM BKARINV "
+ " WHERE BKAR_INV_SONUM > 150000 "
+ " AND BKAR_INV_SONUM LIKE ?"
+ " ORDER BY BKAR_INV_SONUM DESC");
stmt.setString(1, full);
rs = stmt.executeQuery();
此代码产生错误:
java.sql.SQLException: [LNA][Pervasive][ODBC Engine Interface]Error in predicate: BKAR_INV_SONUM LIKE ?
BKAR_INV_SONUM 类型在数据库中是 int。这会影响我的准备语句吗?我应该使用setInt()
而不是setString()
吗?