First, create the following project:
650) this. width = 650; "border =" 0 "alt =" "src =" http://img1.51cto.com/attachment/201212/015103674.jpg "/>
Write model layer first
Using System;
Using System. Collections. Generic;
Using System. Linq;
Using System. Text;
Namespace Model
{
Public class Student
{
Private string stuId;
Public string StuId
{
Get {return stuId ;}
Set {stuId = value ;}
}
Private string stuPwd;
Public string StuPwd
{
Get {return stuPwd ;}
Set {stuPwd = value ;}
}
Private string stuName;
Public string StuName
{
Get {return stuName ;}
Set {stuName = value ;}
}
Private string stuAge;
Public string StuAge
{
Get {return stuAge ;}
Set {stuAge = value ;}
}
Private string stuSex;
Public string StuSex
{
Get {return stuSex ;}
Set {stuSex = value ;}
}
Private string stuTel;
Public string StuTel
{
Get {return stuTel ;}
Set {stuTel = value ;}
}
Private string stuAddr;
Public string StuAddr
{
Get {return stuAddr ;}
Set {stuAddr = value ;}
}
Private string stuAudit;
Public string StuAudit
{
Get {return stuAudit ;}
Set {stuAudit = value ;}
}
}
}
650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/1643501a3-1.jpg "/>
Then write the data link layer:
Using System;
Using System. Collections. Generic;
Using System. Linq;
Using System. Text;
Using System. Data. SqlClient;
Using System. Data;
Using Model;
Namespace DAL
{
Public class Student_DAL
{
/// <Summary>
/// Verify User Login
/// </Summary>
/// <Param name = "user"> </param>
/// <Param name = "right"> </param>
/// <Returns> </returns>
Public object CheckStuLogin (Student student, string right)
{
String sqlText;
SqlText = "select stuPwd from stuInfo where stuId = @ userId ";
SqlParameter [] paras = new SqlParameter [1]
{
New SqlParameter ("userId", student. StuId)
};
Object obj = SqlLink. GetScaler (sqlText, paras );
Return obj;
}
}
}
650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/1643505249-2.jpg "/>
650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/1643502E8-3.jpg "/>
650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/1643503247-4.jpg "/>
Then write the Business Layer
Using System;
Using System. Collections. Generic;
Using System. Linq;
Using System. Text;
Using DAL;
Using Model;
Using System. Data;
Namespace BLL
{
Public class Student_BLL
{
Student_DAL studal = new Student_DAL ();
Public int CheckStuLogin (Student student, string right)
{
Object obj = studal. CheckStuLogin (student, right );
Int result =-1;
If (obj = null)
{
Result = 0; // the user does not exist.
}
Else if (obj. ToString (). Trim () = student. StuPwd)
{
Result = 1; // correct
}
Else if (obj. ToString (). Trim ()! = Student. StuPwd)
{
Result = 2; // incorrect password
}
Else
{
Result = 3; // System Error
}
Return result;
}
}
}
650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/16435055Q-5.jpg "/>
Then write the presentation layer
650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/1643504535-6.jpg "/>
The above is only part of the code and. You can leave a message or send an email if you need detailed code or database scripts. 191660130@qq.com
The entire project is as follows:
The review result is as follows:
650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/1643504H0-7.jpg "/>
The effect of failing to pass the review is as follows:
650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/1643503541-8.jpg "/>
650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/164350L13-9.jpg "/>
Background review:
650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/164350KS-10.jpg "/>
This article from the "Love-JS" blog, please be sure to keep this source http://leileiaijishu.blog.51cto.com/6286126/1095712