addcompany2.aspx.cs
来自「这是一个学生服务管理系统」· CS 代码 · 共 93 行
CS
93 行
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
{
/// <summary>
/// modifyCompany 的摘要说明。
/// </summary>
public class modifyCompany : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.Label Label2;
protected System.Web.UI.WebControls.Label Label3;
protected System.Web.UI.WebControls.Label Label4;
protected System.Web.UI.WebControls.Label Label5;
protected System.Web.UI.WebControls.Label Label6;
protected System.Web.UI.WebControls.TextBox txtComAdd;
protected System.Web.UI.WebControls.TextBox txtContact;
protected System.Web.UI.WebControls.TextBox txtTel;
protected System.Web.UI.WebControls.TextBox txtComName;
protected System.Web.UI.WebControls.TextBox txtKeyWord;
protected System.Web.UI.WebControls.Button btnAdd;
protected System.Web.UI.WebControls.Label LabAddUrl;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator2;
protected System.Web.UI.WebControls.Label labURL;
private void Page_Load(object sender, System.EventArgs e)
{
this.labURL.Text = Request["companyURL"].ToString();
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void btnAdd_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 = "insert into company ( 公司名,公司网址,关键字,联系电话,联系人,公司地址) values ('" + txtComName.Text.Trim() + "','www." + this.labURL.Text + "','"
+ txtKeyWord.Text.Trim() + "','" + txtTel.Text.Trim() + "','" + txtContact.Text.Trim() + "','" + txtComAdd.Text.Trim() + "')";
Comm.Connection = Conn;
Conn.Open();
int count =0;
count = Comm.ExecuteNonQuery();
Comm.CommandText = "insert into url (公司名,公司网址,关键字,跟踪人,跟踪开始日期,处理) values ('" + txtComName.Text.Trim() +"','www." + this.labURL.Text + "','" +
this.txtKeyWord.Text.Trim() + "','" + Session["name"].ToString() + "','" + System.DateTime.Now.ToString() + "','修改')" ;
count +=Comm.ExecuteNonQuery();
Conn.Close();
if (count==0)
Response.Redirect("addResult.aspx?result=增加失败,请重试");
else
Response.Redirect("addResult.aspx?result=增加成功");
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?