Create proc 存储过程名 @a1 varchar(50) intput, @a2 Varchar(50) intput, @a3 boolean output As Begin If 密码正确 Begin Set @a3=Ture Return @a3 Else Set @a3=False Return @a3 End End
实际上这个问题也可以在程序端直接实现 就是用Select count(*) From 你的密码表 Where 用户名='....' and 密码='....' 然后调用 与其想对应的command的SelectScalar方法 具体代码如下: SQlConnection mycon=New SqlConnection('连机字符串'); String sqlstr =Select count(*) From 你的密码表 Where 用户名='....' and 密码='....'; SqlCommand=mycom New Sqlcommand(sqlstr,'mycon'); mycon.Open() mycom.ExecuteScalar() If mycom.ExecuteScalar=1 MessageBox.show('密码正确'); ElseIf mycom.ExecteScalar=-1 MessageBox.show("密码错误f");