2016-05-23 117 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是真实的来自用户注册表的数据