update1.aspx.cs
来自「掌握计算机管理信息系统设计的一般方法」· CS 代码 · 共 49 行
CS
49 行
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 + =
减小字号Ctrl + -
显示快捷键?