关于'该语句没有返回结果集。'的一个错误 20
这个问题是在数据库由sql2000移植到sql2005时遇到的,使用驱动jdbc1.2,出现问题的语句如下:StringsqlProc="{calldbo.sp_comm...
这个问题是在数据库由sql2000移植到sql2005时遇到的,使用驱动jdbc1.2,出现问题的语句如下:
String sqlProc = "{call dbo.sp_commPageProp_return(?)}";
PreparedStatement cstm = con.prepareStatement(sqlProc,ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
cstm.setString(1,"kyzdsj");
rs = cstm.executeQuery();//这句执行时出现异常,sqlProc变量换了好几种别的写法还是一样的错误
异常如下:
19:21:42,421 INFO [STDOUT] com.microsoft.sqlserver.jdbc.SQLServerException: 该语句没有返回结果集。
19:21:42,421 INFO [STDOUT] at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(Unknown Source)
19:21:42,421 INFO [STDOUT] at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(Unknown Source)
19:21:42,421 INFO [STDOUT] at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(Unknown Source)
19:21:42,421 INFO [STDOUT] at com.microsoft.sqlserver.jdbc.TDSCommand.execute(Unknown Source)
19:21:42,421 INFO [STDOUT] at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(Unknown Source)
19:21:42,421 INFO [STDOUT] at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(Unknown Source)
19:21:42,421 INFO [STDOUT] at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(Unknown Source)
19:21:42,421 INFO [STDOUT] at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(Unknown Source)
19:21:42,421 INFO [STDOUT] at org.apache.jsp.test.test_jsp._jspService(org.apache.jsp.test.test_jsp:112)
/*不要嫌分下啊,急救!*/
这个存储过程在数据库里可以顺利执行过去,返回一个结果集。 展开
String sqlProc = "{call dbo.sp_commPageProp_return(?)}";
PreparedStatement cstm = con.prepareStatement(sqlProc,ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
cstm.setString(1,"kyzdsj");
rs = cstm.executeQuery();//这句执行时出现异常,sqlProc变量换了好几种别的写法还是一样的错误
异常如下:
19:21:42,421 INFO [STDOUT] com.microsoft.sqlserver.jdbc.SQLServerException: 该语句没有返回结果集。
19:21:42,421 INFO [STDOUT] at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(Unknown Source)
19:21:42,421 INFO [STDOUT] at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(Unknown Source)
19:21:42,421 INFO [STDOUT] at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(Unknown Source)
19:21:42,421 INFO [STDOUT] at com.microsoft.sqlserver.jdbc.TDSCommand.execute(Unknown Source)
19:21:42,421 INFO [STDOUT] at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(Unknown Source)
19:21:42,421 INFO [STDOUT] at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(Unknown Source)
19:21:42,421 INFO [STDOUT] at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(Unknown Source)
19:21:42,421 INFO [STDOUT] at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(Unknown Source)
19:21:42,421 INFO [STDOUT] at org.apache.jsp.test.test_jsp._jspService(org.apache.jsp.test.test_jsp:112)
/*不要嫌分下啊,急救!*/
这个存储过程在数据库里可以顺利执行过去,返回一个结果集。 展开
2008-02-14
展开全部
用Open()
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询