📄 update1.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 update1 : System.Web.UI.Page
{
public 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 customertype where customertpyecode=" + "'" + ctcontent + "'";
SqlDataReader dr=cla.GetSingleCTCode(cmdText);
if (dr.Read())
{
TextBox1.Text = dr["customertpyecode"].ToString();
TextBox2.Text = dr["customertypename"].ToString();
}
dr.Close();
}
protected void Button1_Click(object sender, EventArgs e)
{
string temp = Request.QueryString["ctcodeID"];
edit cla = new edit();
String cmdtext = "update customertype set customertpyecode='" + TextBox1.Text.Trim() +
"',customertypename='" + TextBox2.Text.Trim() + "' where customertpyecode=" + "'" + temp + "'";
cla.execute(cmdtext);
Response.Write("<script>alert('" + "更新数据成功,请妥善保管好数据!" + "');</script>");
Response.Redirect("custometype.aspx");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -