大家帮我看看这段代码那里错误啊??关于PreparedStatement的!!
如题,谢谢!
public int execSELECT(String sql) throws SQLException
{
if (conn == null)
throw new SQLException ("连接还没有被建立!");
if (sql == null)
throw new SQLException ("SQL-statement是null!");
clearResult ();
/////创建可滚动的只读的数据集
pstmt = conn.createPreparedStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
rs = pstmt.executeQuery (sql);
rsmd = rs.getMetaData();
numCols = rsmd.getColumnCount();
return numCols;
}
public int execSELECT(String sql) throws SQLException
{
if (conn == null)
throw new SQLException ("连接还没有被建立!");
if (sql == null)
throw new SQLException ("SQL-statement是null!");
clearResult ();
/////创建可滚动的只读的数据集
pstmt = conn.createPreparedStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
rs = pstmt.executeQuery (sql);
rsmd = rs.getMetaData();
numCols = rsmd.getColumnCount();
return numCols;
}
...全文
相关推荐
PreparedStatement详细用法
PreparedStatement详细用法
connection 和 preparedstatement 的关闭问题
什么时候用statement,什么时候用preparedstatement
java中PreparedStatement和Statement的区别
java中PreparedStatement和Statement的区别
kotlin代码中!!操作符的清楚方法
主要给大家介绍了关于kotlin代码中!!操作符的清楚方法,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
JDBC之PreparedStatement类中预编译的综合应用解析
SQL 语句被预编译并存储在 PreparedStatement 对象中。然后可以使用此对象多次高效地执行该语句


Web 开发
