代码!!!!!!!!!!!!!!!!
protected void btnreg_Click(object sender, EventArgs e)
{
if ( txtusername.Text == "" || txtuserpwd.Text == "" || txtuserpwdtwo.Text == "" || txtuseraddress.Text == "" || txtuserphone.Text == "" || txtuserEmail.Text == "" || txtuserprotect.Text=="")
{
Label2.Text = "<script>alert('请填写完整再提交')</script>"; }
else
{
if (HttpContext.Current.Session["CheckCode"].ToString().Equals(this.txtusercode.Text.ToString().Trim()))
{
SqlConnection con = new SqlConnection(connectionString); string insertorder = "insert into users(username,userpwd,usercid,userEmail,useraddress,userphone) values('" + txtusername.Text + "','" + txtuserpwdtwo.Text + "','" + txtuserprotect.Text + "','" + txtuserEmail.Text + "','" + txtuseraddress.Text + "','" + txtuserphone.Text + "')"; SqlCommand cmd = new SqlCommand(insertorder, con); try
{
con.Open();
cmd.ExecuteNonQuery();
Response.AddHeader("refresh", "0");
}
catch (Exception ex)
{
Response.Write(ex.Message);
Response.End();
}
finally
{
con.Close();
}
}
else
{
Label2.Text = "<script>alert('验证码输入不正确')</script>";
}
}
}
protected void btnreg_Click(object sender, EventArgs e)
{
if ( txtusername.Text == "" || txtuserpwd.Text == "" || txtuserpwdtwo.Text == "" || txtuseraddress.Text == "" || txtuserphone.Text == "" || txtuserEmail.Text == "" || txtuserprotect.Text=="")
{
Label2.Text = "<script>alert('请填写完整再提交')</script>"; }
else
{
if (HttpContext.Current.Session["CheckCode"].ToString().Equals(this.txtusercode.Text.ToString().Trim()))
{
SqlConnection con = new SqlConnection(connectionString); string insertorder = "insert into users(username,userpwd,usercid,userEmail,useraddress,userphone) values('" + txtusername.Text + "','" + txtuserpwdtwo.Text + "','" + txtuserprotect.Text + "','" + txtuserEmail.Text + "','" + txtuseraddress.Text + "','" + txtuserphone.Text + "')"; SqlCommand cmd = new SqlCommand(insertorder, con); try
{
con.Open();
cmd.ExecuteNonQuery();
Response.AddHeader("refresh", "0");
}
catch (Exception ex)
{
Response.Write(ex.Message);
Response.End();
}
finally
{
con.Close();
}
}
else
{
Label2.Text = "<script>alert('验证码输入不正确')</script>";
}
}
}
解决方案 »
- MVC3.0环境下为什么我的右键没有创建视图或者转到视图选项?
- GridView后台代码指定列宽
- 有关web service运行
- 同一个aspx页面中放两个iframe的问题
- 求救:::::asp.net连接oracle的问题,为什么连不上啊?????????
- 100分求解!!!!!!!!!
- 请问如何根据来访者的ip来创建文件啊
- 调查一下大家写ASP.NET是时候是喜欢写成单文件还是写成Codebehind形似,能不能说明一下有缺点(vs.net)
- 怎么用服务器端的BUTTON打开一个新的画面?
- 制作一个网页刷票软件(有验证码)遇到问题
- 如何却掉asp.net页面生成的多余代码
- 整个fileup控件的传值
Session["UserName"] = txtName.Text;
Response.Redirect("NavigatePage.aspx"); 在NavigatePage.aspx页面中,将Session对象的值显示在界面上,其代码如下:
if (Session["UserName"] == null)
{
Response.Redirect("Default.aspx");
}
else
{
Label1.Text =Session["UserName"].ToString();
}