C # Registration Form

Source: Internet
Author: User

[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;

 

 
 

 

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.