📄 update2.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 update2 : System.Web.UI.Page
{
private string ctcontent = null;
protected void Page_Load(object sender, EventArgs e)
{
ctcontent = Request.QueryString["ctcodeID"];
if (!Page.IsPostBack)
{
BindData(ctcontent);
}
}
private void BindData(String ctcontent)
{
edit cla = new edit();
string cmdText = "select * from customer where customercode=" + "'" + ctcontent + "'";
SqlDataReader dr = cla.GetSingleCTCode(cmdText);
if (dr.Read())
{
ccode.Text = dr["customercode"].ToString();
Type.Text = dr["customertypecode"].ToString();
cname.Text = dr["customername"].ToString(); ;
caddress.Text = dr["address"].ToString();
cmail.Text = dr["email"].ToString();
cphone.Text = dr["phone"].ToString();
ctel.Text = dr["mobile"].ToString();
cbirth.Text = dr["birthday"].ToString();
chobby.Text = dr["hobby"].ToString();
cnote.Text = dr["note"].ToString();
}
dr.Close();
}
protected void Button1_Click(object sender, EventArgs e)
{
string temp = Request.QueryString["ctcodeID"];
edit cla = new edit();
String cmdtext = "update customer set customercode='" + ccode.Text.Trim() +
"',customertypecode='" + Type.Text.Trim() +
"',customername='" + cname.Text.Trim() +
"',address='" + caddress.Text.Trim() +
"',phone='" + cphone.Text.Trim() +
"',email='" + cmail.Text.Trim() +
"',mobile='" + ctel.Text.Trim()+
"',birthday='"+cbirth.Text.Trim()+
"',hobby='"+chobby.Text.Trim()+
"',note='"+cnote.Text.Trim()+
"'where customercode=" + "'" + temp + "'";
cla.execute(cmdtext);
Response.Write("<script>alert('" + "更新数据成功,请妥善保管好数据!" + "');</script>");
Response.Redirect("csmanage.aspx");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -