What the team needs to do:
1, with SQL Server 2008 database software or other database system (such as MySQL) first build a database, the database name is repair.
2, re-build a user table, the name of the user table is User_info.
3, the table has two fields: username and password, the type is char type, the length of their own decision.
4, you first add several users in the table, so that the software login test
5. Connect the database with code
6, when the user clicks the "Login" button, the software will display the login information in the label according to the database query results.
The code is as follows:
String strconn = "server= (local); integrated Security=true;database=repair";
SqlConnection conn = new SqlConnection (strconn);
String sql = "SELECT COUNT (*) from User_info where username= '" + TextBox1.Text + "'";
SqlCommand cmd = new SqlCommand (SQL, conn);
Conn. Open ();
int S = Convert.ToInt32 (cmd. ExecuteScalar ());
if (S = = 0)
{
Label3. Text = "User name does not exist!";
}
Else
{
sql = "SELECT COUNT (*) from User_info where username= '" + TextBox1.Text + "' and password= '" +textbox2.text+ "'";
cmd = new SqlCommand (SQL, conn);
S = Convert.ToInt32 (cmd). ExecuteScalar ());
if (S = = 0)
{
Label3. Text = "Password is wrong, please re-enter!";
TextBox2.Text = "";
}
Else
{
Label3. Text = "Congratulations" +textbox1.text+ "landing success!";
}
}
Conn. Close ();
Test:
Psp:
Division:
Write code: He Yanpeng Build database: Li Hua Fei; Shen Li-nan database: Zhang Send; Xu Kunpeng test: Horse Admiration write document: He Rendong
Summarize:
This homework in the previous learning C # when the teacher made a similar project, so this time the work is relatively simple, but there are some areas that need our attention and improvement, such as: Specific personnel tasks, collaboration between people, unity and so on, we are a team, need is everyone involved, To obtain knowledge and happiness, and the difficulties encountered in the process, is by everyone in a discussion to discuss the solution, in the middle of a lot of things, in this not a narrative, in short, teamwork, and unity of the most important, as long as the effort will not solve the problem.
Team members:
Group leader: He Yanpeng (Study No.: 1025) Deputy Leader: MA Admiration (study number: 1080) Group members: Zhang Send (study number: 1149), Shen Li-nan (Study No.: 1087), Xu Kunpeng (Study No.: 1122), He Rendong (Study No.: 1024), Li Huafei (School Number: 1038)
Sixth time Assignment