日期:2014-05-18 浏览次数:20993 次
string connStr = ConfigurationManager.ConnectionStrings["connStr"].ToString();//在配置文件中获得连接字符 using (SqlConnection conn = new SqlConnection(connStr)) { if (rbtn_zj.Checked) { string pass = ClsMD5.Encrypt(txt_pwd.Text, "hongying*wangluo");//密文 str = "insert into T_doctors(type,dUserName,dPwd,dpassword,dMail,dTrueName,dGander,dHospital,dHAddress,dDepartment,dMajor,dAbout,dPhone,dProfessional,dLiecense)values(@type,@dUserName,@dPwd,@dpassword,@dMail,@dTrueName,@dGander,@dHospital,@dHAddress,@dDepartment,@dMajor,@dAbout,@dPhone,@dProfessional,@dLiecense)"; int result = SqlHelper.ExecuteNonQuery(connStr, CommandType.Text, str, new SqlParameter("@type", rbtn_zj.Text), new SqlParameter("@dUserName", ys_Name.Text), new SqlParameter("@dPwd", ys_pwd.Text), new SqlParameter("@dpassword", pass), new SqlParameter("@dMail", ys_mail.Text), new SqlParameter("@dTureName", true_name.Text), new SqlParameter("@dGander", rdfemal.Text), new SqlParameter("@dHospital", txt_hospital.Text), new SqlParameter("@dHAddress", txt_adress.Text), new SqlParameter("@dDepartment", list_keshi.SelectedValue), new SqlParameter("@dMajor", txt_major.Text), new SqlParameter("@dAbout", txt_jianli.Text), new SqlParameter("@dPhone", txt_photo.Text), new SqlParameter("@dProfessional", list_zhicheng.SelectedValue), new SqlParameter("@dLiecense", FileUpload1.FileName)); Response.Write("<script type='text/javascript'>alert('恭喜你,您成功注册了医生用户,点此转到登陆界面>>>');document.location='DengLu.aspx';</script>"); } if (rbtn_pt.Checked) { string pass = ClsMD5.Encrypt(txt_pwd.Text, "hongying*wangluo");//密文 str = "insert into T_users(type,userName,uPwd,password,uMail)values(@type,@userName,@uPwd,@password,@uMail)"; int result = SqlHelper.ExecuteNonQuery(connStr, CommandType.Text, str, new SqlParameter("@type", rbtn_pt.Text), new SqlParameter("@userName", txt_username.Text), new SqlParameter("@uPwd", txt_pwd.Text), new SqlParameter("@password", pass), new SqlParameter("@uMail", txt_mail.Text)); Response.Write("<script type='text/javascript'>alert('恭喜你,您成功注册了普通用户,点此转到登陆界面>>>');document.location='DengLu.aspx';</script>"); //Response.Redirect("DengLu.aspx");//重定向到登录界面 } }