C# 插入数据
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
string username = Request["username"];
string userpwd = Request["userpwd"];
string drop = this.level.Text.ToString();
string post = position.SelectedValue.ToString();
string depa = deparment.SelectedValue.ToString();
string usernumber = this.bianhao.Text;
string realname = this.realname.Text;
string xueli = this.xueli.SelectedValue.ToString();
string zhichen = this.zhicheng.SelectedValue.ToString();
string zhuangkuang = this.state.SelectedValue.ToString();
string byxuexiao = this.byshool.SelectedValue.ToString();
string XingBie = this.Sex.Text;//性别
string MingZu = this.MZ.Text;//名族
DateTime AddTime = DateTime.Now;
StockClass sc = new StockClass();
if (sc.validate(username))
{
Response.Write("<script>alert('用户名中不能含有非法字符');history.back()</script>");
return;
}
if (sc.validate(userpwd))
{
Response.Write("<script>alert('密码中不能含有非法字符');history.back()</script>");
return;
}
SqlConnection strcon = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["strcon"]);
strcon.Open();
SqlCommand scd = new SqlCommand("select * from rs_User where username='" + username + "'", strcon);
int coun