Simple asp+ Registration System

Source: Internet
Author: User
asp+ <%@ Page language= "C #"%>
<%@ Import namespace= "System.Data"%>
<%@ Import namespace= "System.Data.SQL"%>
<link rel= "stylesheet" type= "Text/css" href= "Main.css" >
<script language= "C #" runat=server>
void btnSubmit_Click (Object src,eventargs E)
{
if (Page.IsValid)
{
String strSQL;
Strsql= "INSERT into Tbluserinfo VALUES (@UserName, @PassWord, @Email)";

SqlConnection cnn=new SqlConnection ("Server=niu; Uid=sa; pwd=;D atabase=aspx ");
SQLCommand cmm=new SQLCommand (STRSQL,CNN);

Cmm. Parameters.Add (New SqlParameter ("@UserName", sqldatatype.varchar,20));
Cmm. parameters["@UserName"]. Value=txtname.text;

Cmm. Parameters.Add (New SqlParameter ("@PassWord", sqldatatype.varchar,20));
Cmm. parameters["@PassWord"]. Value=txtname.text;

Cmm. Parameters.Add (New SqlParameter ("@Email", sqldatatype.varchar,60));
Cmm. parameters["@Email"]. Value=txtname.text;

Cmm. Activeconnection.open ();
Try
{
Cmm. Execute ();
Cmm. Activeconnection.close ();
Page.navigate ("result.aspx");
}
Catch
{
lblmsg.style["Color"]= "red";
lblmsg.text= "Insert data Error";
}
}

}
</Script>
<body>
&LT;H2 align= "Center" >asp+ Registration system <asp:label id= "Lblmsg" runat=server/>
<form runat=server>
<table bgcolor= "#eeeeee" cellpadding= "ten" align= "Center" >
<tr>
<td> name:</td>
<td>
<asp:textbox id= "txtname" maxlength= "class=" mytext
</td>
<td>
<asp:requiredfieldvalidator id= "Rfvname"
Controltovalidate= "Txtname"
Display= "Dynamic"
Initalvalue= ""
Errormessage= "*"
Runat=server>
</ASP:RequiredFieldValidator>
</td>
</tr>
<tr>
<td> Password:</td>
<td>
<asp:textbox id= "Txtpassword" textmode= "PassWord" "maxlength=" class= "MyText" runat=server/>
</td>
<td>
<asp:requiredfieldvalidator id= "Rfvpassword"
Controltovalidate= "Txtpassword"
Display= "Dynamic"
Initialvalue= ""
Errormessage= "*"
Runat=server>
</ASP:RequiredFieldValidator>
</td>
</tr>
<tr>
<td> Confirm Password:</td>
<td>
<asp:textbox id= "Txtrepassword" textmode= "PassWord" "maxlength=" class= "MyText" runat=server/>
</td>
<td>
<asp:requiredfieldvalidator id= "Rfvrepassword"
Controltovalidate= "Txtrepassword"
Display= "Dynamic"
Initialvalue= ""
Errormessage= "*"
Runat=server>
</ASP:RequiredFieldValidator>
<asp:comparevalidator id= "Cvrepassword"
Controltovalidate= "Txtrepassword" controltocompare= "Txtpassword"
Display= "Dynamic"
errormessage= "Password confirmation wrong, please note the letter case!" "
Runat=server>
</ASP:CompareValidator>
</td>
</tr>
<tr>
<td> e-Mail:</td>
<td>
<asp:textbox id= "Txtemail" maxlength= "class=" mytext
</td>
<td>
<asp:requiredfieldvalidator id= "Rvfemail"
Controltovalidate= "Txtemail"
Initialvalue= ""
Display= "Dynamic"
Errormessage= "*"
Runat=server>
</ASP:RequiredFieldValidator>
<asp:regularexpr



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.