[Csharp]
Add
The following code: string thisConnectin = "server = XIAOLI-PC \ XIAOLI; Integrated Security = true; database = map ";
SqlConnection con;
Con = new SqlConnection (thisConnectin );
If (this. CheckInfo ())
{
String cmd = "insert into tb_user VALUES ('" + textBox1.Text + "', '" + textBox2.Text + "')";
SqlCommand com = new SqlCommand (cmd, con );
Con. Open (); // close? Close?
// Com. ExecuteNonQuery ();
If (com. ExecuteNonQuery ()! = 0) // com. ExecuteNonQuery () execute 'Row D? Sentence ?,? And then returns the response? ? Affected? Movie? Number of D rows in response
MessageBox. Show ("why? Á áchengé | !? ");
Else
MessageBox. Show ("why? Juán? Cheng é Gong | !? ");
Con. Close (); // Close? Close?
Form3 frm2 = new Form3 ();
Frm2.Show ();
}
Add
The following code: string thisConnectin = "server = XIAOLI-PC \ XIAOLI; Integrated Security = true; database = map ";
SqlConnection con;
Con = new SqlConnection (thisConnectin );
If (this. CheckInfo ())
{
String cmd = "insert into tb_user VALUES ('" + textBox1.Text + "', '" + textBox2.Text + "')";
SqlCommand com = new SqlCommand (cmd, con );
Con. Open (); // close? Close?
// Com. ExecuteNonQuery ();
If (com. ExecuteNonQuery ()! = 0) // com. ExecuteNonQuery () execute 'Row D? Sentence ?,? And then returns the response? ? Affected? Movie? Number of D rows in response
MessageBox. Show ("why? Á áchengé | !? ");
Else
MessageBox. Show ("why? Juán? Cheng é Gong | !? ");
Con. Close (); // Close? Close?
Form3 frm2 = new Form3 ();
Frm2.Show ();
}
[Csharp]
Two self-written functions Alert () and checkInfo () are called in the button function.
These two functions are used to confirm whether the edit box is empty and whether the password is consistent with the password value.
Void Alert (string message)
{
MessageBox. Show (null, message, "letter? Information delivery? ? ",
MessageBoxButtons. OK, MessageBoxIcon. Information );
}
Bool CheckInfo ()
{
If (this. textBox1.Text. Trim () = "")
{
Alert ("use? User § name? No? ? Whole? ");
Return false;
}
If (this. textBox2.Text. Trim () = "")
{
Alert ("password? No? ? Whole? ");
Return false;
}
If (this. textBox3.Text. Trim () = "")
{
Alert ("OK? Recognize? Password? No? ? Whole? ");
Return false;
}
If (this. textBox2.Text. Trim ()! = This. textBox3.Text. Trim ())
{
Alert ("password? And where is it true? Recognize? Password? No? I? To? ");
Return false;
}
Return true;
Two self-written functions Alert () and checkInfo () are called in the button function.
These two functions are used to confirm whether the edit box is empty and whether the password is consistent with the password value.
Void Alert (string message)
{
MessageBox. Show (null, message, "letter? Information delivery? ? ",
MessageBoxButtons. OK, MessageBoxIcon. Information );
}
Bool CheckInfo ()
{
If (this. textBox1.Text. Trim () = "")
{
Alert ("use? User § name? No? ? Whole? ");
Return false;
}
If (this. textBox2.Text. Trim () = "")
{
Alert ("password? No? ? Whole? ");
Return false;
}
If (this. textBox3.Text. Trim () = "")
{
Alert ("OK? Recognize? Password? No? ? Whole? ");
Return false;
}
If (this. textBox2.Text. Trim ()! = This. textBox3.Text. Trim ())
{
Alert ("password? And where is it true? Recognize? Password? No? I? To? ");
Return false;
}
Return true;