未为参数编号0设置该值

时间:2013-07-19 11:15:11

标签: sql-server-2008 remote-access sqljdbc

我有一个商店程序,它运行正常。我可以使用远程连接登录此数据库。 我安装了sqljdbc.jar并添加到tomcat / common / lib。但是当我运行我的应用程序时,我无法从数据库中获取Store Procedure的结果。我收到此错误消息“未为参数编号0设置值”。我怎么解决这个问题?

ALTER PROCEDURE [dbo].[sp_mesaiKontrol]

@mesai_durum AS NVARCHAR(20) OUTPUT,
@hangi_gun AS NVARCHAR(10) OUTPUT,
@menu AS NVARCHAR(20)

AS
BEGIN

DECLARE @tod INT;
DECLARE @gun NVARCHAR(10);
DECLARE @haftaici_MIN nvarchar(5);
DECLARE @haftaici_MAX nvarchar(5);
DECLARE @haftasonu_MIN nvarchar(5);
DECLARE @haftasonu_MAX nvarchar(5);
DECLARE @menu_ad nvarchar(20);

SET @tod = (SELECT (100*DATEPART(HOUR,GETDATE())+ DATEPART(MINUTE,GETDATE())))
SET @gun=(SELECT dbo.udf_DayOfWeek(GETDATE()));
SET @haftaici_MIN =(SELECT HaftaIci_MIN FROM dbo.Mesai_Kontrol WHERE Menu = @menu);
SET @haftaici_MAX =(SELECT HaftaIci_MAX FROM dbo.Mesai_Kontrol WHERE Menu = @menu);
SET @haftasonu_MIN =(SELECT HaftaSonu_MIN FROM dbo.Mesai_Kontrol WHERE Menu = @menu);
SET @haftasonu_MAX =(SELECT HaftaSonu_MAX FROM dbo.Mesai_Kontrol WHERE Menu = @menu);


----------------------------------------  -----------------------------------------------
IF(@gun IN ('Pazartesi', 'Sali', 'Carsamba', 'Persembe', 'Cuma'))
  IF(@tod>=@haftaici_MIN AND @tod<=@haftaici_MAX )
    BEGIN
        SET @mesai_durum='mesai_ici'
        SET @hangi_gun=@gun
        Select @mesai_durum AS MesaiDurumu 
        Select @hangi_gun   AS GUN
    END 
  ELSE
    BEGIN
        SET @mesai_durum='mesai_disi'
        SET @hangi_gun=@gun
        Select @mesai_durum AS MesaiDurumu
        Select @hangi_gun   AS GUN
    END

-------------------------------------------  -------------------------------------------
ELSE IF(@gun IN('Cumartesi','Pazar'))
 IF(@tod>=@haftasonu_MIN AND @tod<=@haftasonu_MAX )
    BEGIN
        SET @mesai_durum='mesai_ici'
        SET @hangi_gun=@gun
        Select @mesai_durum AS MesaiDurumu
        Select @hangi_gun   AS GUN
    END
 ELSE
    BEGIN
        SET @mesai_durum='mesai_disi'
        SET @hangi_gun=@gun
        Select @mesai_durum AS MesaiDurumu
        Select @hangi_gun   AS GUN
    END

END

0 个答案:

没有答案