📄 cst_user_edit.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;
/***************************************************************************************/
/* File Name : CST_user_edit.aspx */
/* Description : update users */
/*Programmer : zhaoqiongyan */
/* Version :v_0.2 */
/***************************************************************************************/
public partial class Admin_CST_user_edit : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
this.TextBox1.Focus();
if (!this.IsPostBack)
{
string strUser_id = Request["id"].ToString();
if (strUser_id == "")
{
}
else
{
user oCat = new user();
DataRowView user_view = oCat.SelectTable(strUser_id).DefaultView[0];
this.TextBox1.Text = user_view["user_id"].ToString();
this.TextBox2.Text = user_view["name"].ToString();
this.Button1.Text = "修改";
this.Label3.Text = "修改用户名称";
this.TextBox1.Enabled = false;
this.TextBox2.Focus();
}
}
}
//string str = Request["id"].ToString();//获取数据表中的数据
// Response.Write(str);//显示获取出来的值
protected void Button1_Click(object sender, EventArgs e)
{
string str = Request["id"].ToString();//获取数据表中的数据
Response.Write(str);//显示获取出来的值
SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=cst;Integrated Security=True");
con.Open();
SqlCommand com = new SqlCommand("update Users set user_id='" + TextBox1.Text + "',name='" + TextBox2.Text + "')", con);
com.ExecuteNonQuery();
Response.Write("编译完成");
}
protected void Button2_Click(object sender, EventArgs e)
{
TextBox1.Text = "";
TextBox2.Text = "";
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -