我有一个存储过程,它运行正确。我可以使用远程连接登录这个数据库。我安装了 sqljdbc.jar 并添加到 tomcat/common/lib 中。但是当我运行我的应用程序时,我无法从数据库中获取存储过程的结果。我收到此错误消息“未为参数编号 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