2016-05-23 55 views
0

我的SQL存儲過程與select只返回沒有值的表,它只顯示沒有任何值的列名稱嗎?爲什麼?如何使用存儲過程檢索表的值?SQL存儲過程選擇只返回沒有值的表格

[1]: http://i.stack.imgur.com/79Gt2.jpg 
USE [Mobile] 
GO 
/****** Object: StoredProcedure [dbo].[UserRegisterproc] Script Date: 05/23/2016 10:51:47 ******/ 
SET ANSI_NULLS ON 
GO 
SET QUOTED_IDENTIFIER ON 
GO 
ALTER procedure [dbo].[UserRegisterproc] 
@mode int=null, 
@id int=null, 
@name varchar(30)=null, 
@usertype varchar(30)=null, 
@username varchar(30), 
@password varchar(30), 
@email varchar(30)=null, 
@mob varchar(30)=null 
as begin 
if (@mode =1) 
begin 
insert into UserRegister (name,usertype,username,password ,email,mob)values(@name,@usertype,@username,@password ,@email,@mob) 
end 
if(@mode =2) 
begin 
select * from UserRegister 
end 
if (@mode =3) 
begin 
update UserRegister set [email protected],[email protected],[email protected] ,[email protected],[email protected] where [email protected] 
end 
if(@mode =4) 
begin 
delete from UserRegister where [email protected] 
end 
if(@mode =5) 
begin 
    select * from UserRegister where username [email protected] and password [email protected] 
    end 
if(@mode =6) 
begin 
    select * from UserRegister where usertype= @usertype 
    end 
    if(@mode =7) 
begin 
    select * from UserRegister where usertype [email protected] and username [email protected] 
    end 
end 
+2

在SP中使用的查詢沒有返回任何行,這就是原因。請發佈SP。 –

+2

你想讓我們猜測嗎? – sagi

+0

請編輯您的答案,並以正確的格式將其添加。 – sagi

回答

1

1)嘗試運行

select * from UserRegister 做出是否存在數據確認表有數據

2)你應該嘗試與運行
select * from UserRegister where usertype ='abc' and username ='abc'

abc是真實的來自用戶註冊表的數據