📄 modify.aspx.cs
字号:
using System;
using System.Data.OleDb;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace sheng.access
{
/// <summary>
/// modify 的摘要说明。
/// </summary>
public class modify : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label modKey;
protected System.Web.UI.WebControls.Label modURL;
protected System.Web.UI.WebControls.Label modName;
protected System.Web.UI.WebControls.Label Label2;
protected System.Web.UI.WebControls.TextBox txtContact;
protected System.Web.UI.WebControls.TextBox txtComAdd;
protected System.Web.UI.WebControls.Button btnModi;
protected System.Web.UI.WebControls.TextBox txtComName;
protected System.Web.UI.WebControls.TextBox txtTel;
protected System.Web.UI.WebControls.Label labURL;
protected System.Web.UI.WebControls.TextBox txtKeyWord;
protected System.Web.UI.WebControls.Label Label3;
private void Page_Load(object sender, System.EventArgs e)
{
if(!Page.IsPostBack)
{
OleDbConnection Conn = new OleDbConnection();
Conn.ConnectionString = " provider = microsoft.jet.oledb.4.0; data source=" + Server.MapPath("access/sheng.mdb");
OleDbCommand Comm = new OleDbCommand();
if(Request["url"]==null)
Response.Redirect("noRecord.aspx");
this.labURL.Text = Request["url"].ToString();
Comm.CommandText = "select * from company where 公司网址 ='" + Request["url"].ToString() + "'";
Comm.Connection = Conn;
Conn.Open();
OleDbDataReader dr = Comm.ExecuteReader();
if(dr.Read())
{
this.txtComAdd.Text = dr["公司地址"].ToString();
this.txtComName.Text = dr["公司名"].ToString();
this.txtContact.Text = dr["联系人"].ToString();
this.txtKeyWord.Text =dr["关键字"].ToString();
this.txtTel.Text = dr["联系电话"].ToString();
}
dr.Close();
Conn.Close();
}
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.btnModi.Click += new System.EventHandler(this.btnModi_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void btnModi_Click(object sender, System.EventArgs e)
{
OleDbConnection Conn = new OleDbConnection();
Conn.ConnectionString = " provider = microsoft.jet.oledb.4.0; data source=" + Server.MapPath("access/sheng.mdb");
OleDbCommand Comm = new OleDbCommand();
Comm.CommandText = "update company set 公司名 ='" + this.txtComName.Text.Trim() + "', 公司地址 ='" + this.txtComAdd.Text.Trim() +"',联系人='" +
txtContact.Text.Trim() + "', 联系电话='" + txtTel.Text.Trim() +"',关键字='" + this.txtKeyWord.Text.Trim() +"' where 公司网址='"
+ this.labURL.Text+ "'";
Comm.Connection = Conn;
Conn.Open();
Comm.ExecuteNonQuery();
Conn.Close();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -