62,243
社区成员




string updatacmd = "update g_user set name='" + txt_name.Text + "',card='" + txt_card.Text + "',riqi='" + txt_money.Text + "',gtel='" + txt_gtel.Text + "',tel='" + txt_tel.Text + "',email='" + txt_email.Text + "',youbian='" + txt_youbian.Text + "',address='" + txt_add.Text + "',sex='" + txt_sex.Text + "',danbaoren='" + txt_danbaoren.Text + "', job='" + txt_joy.Text + "' where id='" + txt_serch.Text + "'";
public bool getupdata()
{
bool flag = false;
SqlConnection conn = null;
dbcon db = new dbcon();
string updatacmd = "update g_user set name='" + txt_name.Text + "',card='" + txt_card.Text + "',riqi='" + txt_money.Text + "',gtel='" + txt_gtel.Text + "',tel='" + txt_tel.Text + "',email='" + txt_email.Text + "',youbian='" + txt_youbian.Text + "',address='" + txt_add.Text + "',sex='" + txt_sex.Text + "',danbaoren='" + txt_danbaoren.Text + "', job='" + txt_joy.Text + "' where id='" + txt_serch.Text + "'";
try
{
conn = db.getcon();
conn.Open();
SqlCommand cmd = new SqlCommand();
cmd.CommandText = updatacmd;
cmd.Connection = conn;
cmd.ExecuteNonQuery();
return true;
}
catch { return false;}
finally{
conn.Close();
}
return flag;
}
protected void btn_tj_Click(object sender, EventArgs e)
{
if (getupdata())
{
Response.Write("<script>alert('修改成功!')</script>");
Response.Redirect("admin_.aspx");
}
else
lab_message.Text = "修改失败!!!";
}
public bool getupdata()
{
bool flag = false;
SqlConnection conn = null;
dbcon db = new dbcon();
string updatacmd = "update g_user set name='" + txt_name.Text + "',card='" + txt_card.Text + "',riqi='" + txt_money.Text + "',gtel='" + txt_gtel.Text + "',tel='" + txt_tel.Text + "',email='" + txt_email.Text + "',youbian='" + txt_youbian.Text + "',address='" + txt_add.Text + "',sex='" + txt_sex.Text + "',danbaoren='" + txt_danbaoren.Text + "', job='" + txt_joy.Text + "' where id='" + txt_serch.Text + "'";
try
{
conn = db.getcon();
conn.Open();
SqlCommand cmd = new SqlCommand();
cmd.CommandText = updatacmd;
cmd.Connection = conn;
SqlDataReader dr = cmd.ExecuteReader();
if (!dr.Read())
{
flag = true;
}
else flag = false;
}
catch { }
finally{
conn.Close();
}
return flag;
}
protected void btn_tj_Click(object sender, EventArgs e)
{
if (getupdata())
{
Response.Write("<script>alert('修改成功!')</script>");
Response.Redirect("admin_.aspx");
}
else
lab_message.Text = "修改失败!!!";
}