Java 该语句在调用存储过程期间未返回结果集

Java 该语句在调用存储过程期间未返回结果集,java,Java,我使用了callable语句,但得到了相同的错误。 我使用了谷歌的很多技巧,但一次又一次地出现同样的错误。在过程中设置NOCOUNT将解决错误PreparedStatement st=con.prepareStatement{call dbo.HrMin?,?};st.setString1,日期字符串;圣塞廷2,7;布尔rs=st.execute;System.out.printlnrss+rs;然后它打印rss falsePut SET NOCOUNT ON in procedure将解决此错

我使用了callable语句,但得到了相同的错误。
我使用了谷歌的很多技巧,但一次又一次地出现同样的错误。

在过程中设置NOCOUNT将解决错误

PreparedStatement st=con.prepareStatement{call dbo.HrMin?,?};st.setString1,日期字符串;圣塞廷2,7;布尔rs=st.execute;System.out.printlnrss+rs;然后它打印rss falsePut SET NOCOUNT ON in procedure将解决此错误我认为您应该将两个答案合并为一个答案并删除另一个答案。
String dateString = null;
SimpleDateFormat sd = new SimpleDateFormat("yyyy/MM/dd");
dateString = sd.format(pumpTime);

PreparedStatement st = con.prepareStatement("{call dbo.HrMin(?,?)}");   st.setString(1,dateString);      
st.setInt(2,7);   
ResultSet rs = st.executeQuery();    while(rs.next())  {}  

procedure is :
USE [NC26]
GO

/****** Object:  StoredProcedure [dbo].[HrMin]    Script Date: 03/29/2016 15:40:56 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

-- =============================================
-- Author:      <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[HrMin]
    -- Add the parameters for the stored procedure here
    @date varchar(10),@tagindex smallint
AS
BEGIN

declare @datenew datetime;
-- To datetime datatype
set @datenew=DATEADD(DD,-1,(SELECT CONVERT(datetime, @date)));
set @datenew=CONVERT(varchar(10), @datenew, 111);
create table #finalresults
(
    hr int,
    val float

)

-- insert the survey table structures for use

insert into #finalresults (hr, val)
Select distinct hr,(Select top 1 val from hrtableView where tagindex=@tagindex 
and dt=@date and hr=t1.hr ) from hrtableView t1 where tagindex =@tagindex
and dt=@date  group by hr;


insert into #finalresults (hr, val)
Select distinct hr,(Select top 1 val from hrtableView1 where tagindex=@tagindex 
and dt=@date and hr=t1.hr ) from hrtableView1 t1 where tagindex =@tagindex
and dt=@date  group by hr;

SELECT hr,val FROM #finalresults
drop table #finalresults

END

GO

error: The statement did not return a result set.
USE [NC26]
GO

/****** Object:  StoredProcedure [dbo].[test]    Script Date: 03/30/2016 10:26:42 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

-- =============================================
-- Author:      <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[test] 
    -- Add the parameters for the stored procedure here
    @date varchar(10),@tagindex smallint
AS
BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;

    declare @datenew datetime;

    create table #finalresults
(
    hr int,
    val float

)

insert into #finalresults (hr, val)
Select distinct hr,(Select top 1 val from hrtableView where tagindex=@tagindex 
and dt=@date and hr=t1.hr ) from hrtableView t1 where tagindex =@tagindex
and dt=@date  group by hr;


insert into #finalresults (hr, val)
Select distinct hr,(Select top 1 val from hrtableView1 where tagindex=@tagindex 
and dt=@date and hr=t1.hr ) from hrtableView1 t1 where tagindex =@tagindex
and dt=@date  group by hr;




SELECT hr,val FROM #finalresults
drop table #finalresults
END

GO