register.aspx页面
<form id="form1" action="login.aspx" method="post">
<input id="UserName" name="UserName" type="text" />
<input id="Pwd" name="pwd" type="password" />
<input id="Submit1" type="submit" value="注册" />
</form>
register.aspx.cs页面
string str1 = Convert.ToString(!string.IsNullOrEmpty(Request.Form["UserName"]));
string sre2 =Convert.ToString(!string.IsNullOrEmpty( Request.Form["pwd"]));
string sqlstr = "Server=.; DataBase=MusicShop; User id=sa; password=123;";
SqlConnection conn = new SqlConnection(sqlstr);
conn.Open();
string str = "insert into login values('" + str1.ToString() + "','" + sre2.ToString() + "')";
SqlCommand con = new SqlCommand(str, conn);
int a = con.ExecuteNonQuery();
眼眸繁星