| 
 string UserName=Request.Form["name"];    string upassword=Request.Form["password"];    string urpassword=Request.Form["rpassword"]; 
   SqlConnection myConn=DBCONN.CreateCon();    myConn.Open();    string strSql = "select * from user01 where name='"+UserName+"'";    SqlCommand cmd= new SqlCommand(strSql,myConn);    SqlDataReader myrs = cmd.ExecuteReader();    if (myrs.Read())    {     L_Check.Text="对不起,该会员名已经存在,请更换再注册,谢谢!";    }    else    { myConn.Close();     myConn.Open();     string SqlStr="insert into user01 (name,password,rpassword) values"     +"('"+UserName+"','"+upassword+"','"+urpassword+"')";     SqlCommand SqlCmd=new SqlCommand(SqlStr,myConn);     SqlCmd.ExecuteNonQuery();     Session["UserName"]=name.Text ;//生成用户的Session     Response.Redirect ("index.aspx");//转向首页,起刷新作用             }    myrs.Close ();//一切读取行为结束后,一定要关闭阅读器    myConn.Close();  |