|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
ASP一般认为只能运行在IIS上,正如前面所提到的,这并不是十分正确,事实上,ASP也能运行在Apache上。ApacheASP可在任意Apache服务器上运行有限的ASP功能,所需做的,只需打开mod_perl。asp+<%@PageLanguage="C#"%>
<%@ImportNamespace="System.Data"%>
<%@ImportNamespace="System.Data.SQL"%>
<html>
<head><title>ASP+注册</title>
<linkrel="stylesheet"type="text/CSS"href="main.css">
<ScriptLanguage="C#"RunAt=Server>
voidbtnSubmit_Click(ObjectSrc,EventArgsE)
{
if(Page.IsValid)
{
StringstrSQL;
strSQL="INSERTINTOtblUserInfoVALUES(@UserName,@PassWord,@Email)";
SQLConnectioncnn=newSQLConnection("Server=niu;UID=sa;PWD=;DataBase=aspx");
SQLCommandcmm=newSQLCommand(strSQL,cnn);
cmm.Parameters.Add(newSQLParameter("@UserName",SQLDataType.VarChar,20));
cmm.Parameters["@UserName"].Value=txtName.Text;
cmm.Parameters.Add(newSQLParameter("@PassWord",SQLDataType.VarChar,20));
cmm.Parameters["@PassWord"].Value=txtName.Text;
cmm.Parameters.Add(newSQLParameter("@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="拔出数据堕落";
}
}
}
</Script>
</head>
<body>
<h2align="center">ASP+注册体系</h2>
<ASP:LabelID="lblMsg"RunAt=Server/>
<formRunAt=Server>
<tablebgcolor="#eeeeee"cellpadding="10"align="center">
<tr>
<td>姓名:</td>
<td>
<ASP:TextBoxID="txtName"MaxLength="20"Class="mytext"RunAt=Server/>
</td>
<td>
<ASP:RequiredFieldValidatorID="rfvName"
ControlToValidate="txtName"
Display="Dynamic"
InitalValue=""
ErrorMessage="*"
RunAt=Server>
</ASP:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>暗码:</td>
<td>
<ASP:TextBoxID="txtPassWord"TextMode="PassWord"MaxLength="20"Class="mytext"RunAt=Server/>
</td>
<td>
<ASP:RequiredFieldValidatorID="rfvPassWord"
ControlToValidate="txtPassWord"
Display="Dynamic"
InitialValue=""
ErrorMessage="*"
RunAt=Server>
</ASP:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>确认暗码:</td>
<td>
<ASP:TextBoxID="txtRePassWord"TextMode="PassWord"MaxLength="20"Class="mytext"RunAt=Server/>
</td>
<td>
<ASP:RequiredFieldValidatorID="rfvRePassWord"
ControlToValidate="txtRePassWord"
Display="Dynamic"
InitialValue=""
ErrorMessage="*"
RunAt=Server>
</ASP:RequiredFieldValidator>
<ASP:CompareValidatorID="cvRePassWord"
ControlToValidate="txtRePassWord"ControlToCompare="txtPassWord"
Display="Dynamic"
ErrorMessage="暗码确认错,请注重字母巨细写!"
Runat=Server>
</ASP:CompareValidator>
</td>
</tr>
<tr>
<td>电子邮件:</td>
<td>
<ASP:TextBoxID="txtEmail"MaxLength="60"Class="mytext"RunAt=Server/>
</td>
<td>
<ASP:RequiredFieldValidatorID="rvfEmail"
ControlToValidate="txtEmail"
InitialValue=""
Display="Dynamic"
ErrorMessage="*"
RunAt=Server>
</ASP:RequiredFieldValidator>
<ASP:RegularExpr</p>asp对于服务器的要求较高,一般的服务器如果访问量一大就垮了,不得不重启。 |
|