如何做一个注册系统?
见下:
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SQL" %>
<html>
<head>
<title>精彩春风之ASP.NET注册</title>
<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=;DataBase=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="插入数据出错";
}
}
}
</Script>
</head>
<body>
<h2 align="center">精彩春风之注册系统</h2>
<ASP:Label ID="lblMsg" RunAt=Server/>
<form RunAt=Server>
<t