?? user_edit1.aspx.cs
字號:
?using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class User_edit1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
SqlConnection strcon = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["strcon"]);
strcon.Open();
SqlDataAdapter sda = new SqlDataAdapter("select * from tb_User where id="+Request["id"],strcon);
DataSet ds = new DataSet();
sda.Fill(ds,"tb_User");
DataRowView rowview=ds.Tables["tb_User"].DefaultView[0];
this.Label1.Text = rowview["Username"].ToString();
this.Userpwd.Text = rowview["Userpwd"].ToString();
this.CompanyName.Text = rowview["CompanyName"].ToString();
for (int i = 1; i < this.UserType.Items.Count; i++)
{
if (this.UserType.Items[i].Text.ToString() == rowview["UserType"].ToString())
{
this.UserType.Items[i].Selected = true;
}
}
this.Linkman.Text = rowview["Linkman"].ToString();
this.Tel.Text = rowview["Tel"].ToString();
this.MobileTelephone.Text = rowview["MobileTelephone"].ToString();
this.Email.Text = rowview["Email"].ToString();
this.Address.Text = rowview["Address"].ToString();
this.Postalcode.Text = rowview["Postalcode"].ToString();
this.Problem.Text = rowview["Problem"].ToString();
this.Answer.Text = rowview["Answer"].ToString();
this.Bewrite.Text = rowview["Bewrite"].ToString();
strcon.Close();
}
}
protected void Button1_Click(object sender, EventArgs e)
{
string id = Request["id"];
SqlConnection strcon = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["strcon"]);
strcon.Open();
SqlCommand scd = new SqlCommand("update tb_User set Userpwd='" + Userpwd.Text.ToString() + "',CompanyName='" + CompanyName.Text.ToString() + "',UserType = '" + this.UserType.Text.ToString() + "',Linkman = '" + this.Linkman.Text.ToString() + "',Tel = '" + this.Tel.Text.ToString() + "',MobileTelephone ='" + this.MobileTelephone.Text.ToString() + "',Email = '" + this.Email.Text.ToString() + "',Address = '" + this.Address.Text.ToString() + "',Postalcode = '" + this.Postalcode.Text.ToString() + "',Bewrite = '" + this.Bewrite.Text.ToString() + "',Problem = '" + this.Problem.Text.ToString() + "',Answer = '" + this.Answer.Text.ToString() + "' where id="+Request["id"], strcon);
scd.ExecuteNonQuery();
Response.Write("<script language=javascript>alert('您已經(jīng)修改成功!');location='javascript:history.go(-1)'</script>");
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -