asp.net会员和管理员在一个表里如何才能只修改会员的个人信息呢
会员和管理员在一个表里我定义了一个type字段0代表会员1代表管理员,我想修改已登录会员的个人信息,请高手帮忙看看怎么改protectedvoidImageButton1...
会员和管理员在一个表里我定义了一个type字段0代表会员1代表管理员,我想修改已登录会员的个人信息,请高手帮忙看看怎么改
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
string zhanghao = Convert.ToString("zhanghao");
string mima = TextBox2.Text.Trim();
string youxiang = TextBox3.Text.Trim();
string shouji = TextBox4.Text.Trim();
string sql = "update users set mima='" + mima + "',youxiang='" + youxiang + "',shouji='" + shouji + "'where type=0 and zhanghao='" + zhanghao + "' and mima='" + mima + "'";
SqlConnection coon = new SqlConnection("server=.;database=shouji;integrated security = true");
SqlCommand comm = new SqlCommand(sql, coon);
try
{
coon.Open();
comm.ExecuteNonQuery();
Response.Write("<script>alert('修改成功')</script>");
DataBind();
}
catch (SqlException s)
{
Label6.Text = "更改个人信息失败!" + s.Message;
}
coon.Close();
} 展开
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
string zhanghao = Convert.ToString("zhanghao");
string mima = TextBox2.Text.Trim();
string youxiang = TextBox3.Text.Trim();
string shouji = TextBox4.Text.Trim();
string sql = "update users set mima='" + mima + "',youxiang='" + youxiang + "',shouji='" + shouji + "'where type=0 and zhanghao='" + zhanghao + "' and mima='" + mima + "'";
SqlConnection coon = new SqlConnection("server=.;database=shouji;integrated security = true");
SqlCommand comm = new SqlCommand(sql, coon);
try
{
coon.Open();
comm.ExecuteNonQuery();
Response.Write("<script>alert('修改成功')</script>");
DataBind();
}
catch (SqlException s)
{
Label6.Text = "更改个人信息失败!" + s.Message;
}
coon.Close();
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询