本文转载自:http://hedyn.iteye.com/blog/856040

在JDBC中调用SQL Server中的存储过程时出现如下异常:

 

    com.microsoft.sqlserver.jdbc.SQLServerException: 该语句没有返回结果集。  
            at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:171)  
            at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:394)  
            at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:340)  
            at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:4575)  
            at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1400)  
            at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:179)  
            at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:154)  
            at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(SQLServerPreparedStatement.java:283)  

解决方法:在存储过程首行加上

SET NOCOUNT ON  

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-25
  • 2022-02-12
  • 2022-01-06
  • 2021-08-28
  • 2021-08-04
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-01
  • 2022-12-23
相关资源
相似解决方案