调用了存储过程login1,然后console.log(source)看到
代码如下QAQ求各位帮下忙
$("#tijiao").bind('click',function(e){
errormsg='';
if(myGetValue('username')=='')
{
errormsg+='<br>用户名不能为空';
}
if(myGetValue('password')=='') {
errormsg+='<br>密码不能为空';
}
s1=myGetValue('username');
s2=myGetValue('password');
if(errormsg==''){
s=s1+' '+s2;
source=myRunStoredProcedure('jqdemos','login1','s');
console.log(source);
if(source[0].n2==1){
alert('found');
}else if(source[0].n1==1){
alert('密码错误');
}else{
alert('no exists');
}
}
else{
alert('errormsg');
}
});
存储过程是这样的:
drop procedure login1
go
create procedure login1 @p1 varchar(50),@p2 varchar(50)
as
declare @n1 int,@n2 int
select @n1=COUNT(*) from Students
where (StudentID=@p1 or email=@p1 or mobile=@p1)
select @n2=count(*) from students
where (StudentID=@p1 or email=@p1 or mobile=@p1) and password=@p2
select @n1 as n1,@n2 as n2
go