create PROCEDURE personlogin
@userid varchar(100),
@password varchar(500),@usertype char(2) output,
@regid int output,
@pemail varchar(100) output
AS begin
select
@regid=regid,
@usertype=usertype,
@pemail=email
from registerinfo
where userid=@userid
and [password]=@password
end
begin
if @@rowcount<1
select @regid=0
select @usertype=''
end
``````````````````````````````````````````````````````````exec personlogin temp,temp
其中temp,是表中的值服务器: 消息 201,级别 16,状态 4,过程 personlogin,行 0
过程 'personlogin' 需要参数 '@usertype',但未提供该参数。
@userid varchar(100),
@password varchar(500),@usertype char(2) output,
@regid int output,
@pemail varchar(100) output
AS begin
select
@regid=regid,
@usertype=usertype,
@pemail=email
from registerinfo
where userid=@userid
and [password]=@password
end
begin
if @@rowcount<1
select @regid=0
select @usertype=''
end
``````````````````````````````````````````````````````````exec personlogin temp,temp
其中temp,是表中的值服务器: 消息 201,级别 16,状态 4,过程 personlogin,行 0
过程 'personlogin' 需要参数 '@usertype',但未提供该参数。
解决方案 »
- 关于.net超链接弹出新的小窗体
- 页面关闭时如何设置变量的值
- [在执行了非查询语句之后,Connection是不是一定要手动关闭?]
- C#、C++、C语言之间有什么区别?
- 哪有 asp.net入门经典(c#篇)电子版下载?(20分钟揭帖)
- 急求删除用户的代码
- ★●asp.net生成xml问题?(100分)
- ===有关".net先锋论坛“用户资料不能更新???
- 什么情况下,数据库需要使用存储过程?存储过程的具体应用?例子?书写方法库?
- 如果不让浏览器提示“刷新“
- treeview中如何根据父、子节点内容形成右侧筛选
- 请问 如何把datatable里符合条件的记录取出来组成另一个datatable?
而另外一个输出参数@regid之所以没有报错,是因为你在使用打印的时候给它赋值了
myParameter.Direction = ParameterDirection.Output;
在调用之前要提供这个参数
OUTPUT是为了给外面取参数用。
你要想不输入参数,就用缺省参数好了。比如@regid int=0 output
大家看一下下面这个存储过程
create proc login
@username char(100),
@state char(2) output
as
if exists(select * from registerinfo where userid=@username)
select @state='1'
else
select @state='0'```````````````````````````````
运行后
exec login temp结果:
服务器: 消息 201,级别 16,状态 4,过程 login,行 0
过程 'login' 需要参数 '@state',但未提供该参数。
可我在asp.net中怎么来运行它?
你可以事先传递一个初始值就可以了。
比如:1,-1,或者0什么的。