📄 ordersform.aspx.cs
字号:
using System;
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;
using System.Data.SqlClient ;
namespace BookersClient
{
/// <summary>
/// Summary description for OrdersForm.
/// </summary>
public class OrdersForm : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label Label1;
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.Label Label7;
protected System.Web.UI.WebControls.Label Label8;
protected System.Web.UI.WebControls.TextBox txtISBN;
protected System.Web.UI.WebControls.TextBox txtName;
protected System.Web.UI.WebControls.TextBox txtAddr1;
protected System.Web.UI.WebControls.TextBox txtAddr2;
protected System.Web.UI.WebControls.TextBox txtCity;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator3;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator4;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator5;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator6;
protected System.Web.UI.WebControls.Button btnOrder;
protected System.Web.UI.WebControls.Button btnClear;
protected System.Web.UI.WebControls.Label Label2;
protected System.Web.UI.WebControls.Label Label3;
protected System.Web.UI.WebControls.Label Label9;
protected System.Web.UI.WebControls.Label Label10;
protected System.Web.UI.WebControls.Label Label11;
protected System.Web.UI.WebControls.Label Label12;
protected System.Web.UI.WebControls.DropDownList lstCardType;
protected System.Web.UI.WebControls.TextBox txtCardNumber;
protected System.Web.UI.WebControls.TextBox txtTitle;
protected System.Web.UI.WebControls.TextBox txtAuthor;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;
protected System.Web.UI.WebControls.TextBox TextBox1;
protected System.Web.UI.WebControls.HyperLink HyperLink1;
protected System.Data.SqlClient.SqlCommand sqlSelectCommand1;
protected System.Data.SqlClient.SqlCommand sqlInsertCommand1;
protected System.Data.SqlClient.SqlCommand sqlUpdateCommand1;
protected System.Data.SqlClient.SqlCommand sqlDeleteCommand1;
protected System.Data.SqlClient.SqlConnection sqlConnection1;
protected System.Data.SqlClient.SqlDataAdapter sqlDataAdapter1;
protected BookersClient.dsCustomers dsCustomers1;
protected System.Web.UI.WebControls.TextBox txtState;
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
txtISBN.Text = Request.QueryString.Get(0).ToString();
txtTitle.Text = Request.QueryString.Get(1).ToString();
txtAuthor.Text = Request.QueryString.Get(2).ToString();
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlInsertCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlUpdateCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlDeleteCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlConnection1 = new System.Data.SqlClient.SqlConnection();
this.sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter();
this.dsCustomers1 = new BookersClient.dsCustomers();
((System.ComponentModel.ISupportInitialize)(this.dsCustomers1)).BeginInit();
this.btnOrder.Click += new System.EventHandler(this.btnOrder_Click);
this.btnClear.Click += new System.EventHandler(this.btnClear_Click);
//
// sqlSelectCommand1
//
this.sqlSelectCommand1.CommandText = "SELECT CustomerID, CustomerName, BillingAddress1, BillingAddress2, BillingAddress" +
"City, BillingAddressState FROM BookerCustDetails";
this.sqlSelectCommand1.Connection = this.sqlConnection1;
//
// sqlInsertCommand1
//
this.sqlInsertCommand1.CommandText = @"INSERT INTO BookerCustDetails(CustomerID, CustomerName, BillingAddress1, BillingAddress2, BillingAddressCity, BillingAddressState) VALUES (@CustomerID, @CustomerName, @BillingAddress1, @BillingAddress2, @BillingAddressCity, @BillingAddressState); SELECT CustomerID, CustomerName, BillingAddress1, BillingAddress2, BillingAddressCity, BillingAddressState FROM BookerCustDetails WHERE (CustomerID = @CustomerID)";
this.sqlInsertCommand1.Connection = this.sqlConnection1;
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@CustomerID", System.Data.SqlDbType.VarChar, 6, "CustomerID"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@CustomerName", System.Data.SqlDbType.VarChar, 50, "CustomerName"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@BillingAddress1", System.Data.SqlDbType.VarChar, 50, "BillingAddress1"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@BillingAddress2", System.Data.SqlDbType.VarChar, 50, "BillingAddress2"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@BillingAddressCity", System.Data.SqlDbType.VarChar, 20, "BillingAddressCity"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@BillingAddressState", System.Data.SqlDbType.VarChar, 20, "BillingAddressState"));
//
// sqlUpdateCommand1
//
this.sqlUpdateCommand1.CommandText = @"UPDATE BookerCustDetails SET CustomerID = @CustomerID, CustomerName = @CustomerName, BillingAddress1 = @BillingAddress1, BillingAddress2 = @BillingAddress2, BillingAddressCity = @BillingAddressCity, BillingAddressState = @BillingAddressState WHERE (CustomerID = @Original_CustomerID) AND (BillingAddress1 = @Original_BillingAddress1) AND (BillingAddress2 = @Original_BillingAddress2) AND (BillingAddressCity = @Original_BillingAddressCity) AND (BillingAddressState = @Original_BillingAddressState) AND (CustomerName = @Original_CustomerName); SELECT CustomerID, CustomerName, BillingAddress1, BillingAddress2, BillingAddressCity, BillingAddressState FROM BookerCustDetails WHERE (CustomerID = @CustomerID)";
this.sqlUpdateCommand1.Connection = this.sqlConnection1;
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@CustomerID", System.Data.SqlDbType.VarChar, 6, "CustomerID"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@CustomerName", System.Data.SqlDbType.VarChar, 50, "CustomerName"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@BillingAddress1", System.Data.SqlDbType.VarChar, 50, "BillingAddress1"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@BillingAddress2", System.Data.SqlDbType.VarChar, 50, "BillingAddress2"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@BillingAddressCity", System.Data.SqlDbType.VarChar, 20, "BillingAddressCity"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@BillingAddressState", System.Data.SqlDbType.VarChar, 20, "BillingAddressState"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_CustomerID", System.Data.SqlDbType.VarChar, 6, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "CustomerID", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_BillingAddress1", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "BillingAddress1", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_BillingAddress2", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "BillingAddress2", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_BillingAddressCity", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "BillingAddressCity", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_BillingAddressState", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "BillingAddressState", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_CustomerName", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "CustomerName", System.Data.DataRowVersion.Original, null));
//
// sqlDeleteCommand1
//
this.sqlDeleteCommand1.CommandText = @"DELETE FROM BookerCustDetails WHERE (CustomerID = @Original_CustomerID) AND (BillingAddress1 = @Original_BillingAddress1) AND (BillingAddress2 = @Original_BillingAddress2) AND (BillingAddressCity = @Original_BillingAddressCity) AND (BillingAddressState = @Original_BillingAddressState) AND (CustomerName = @Original_CustomerName)";
this.sqlDeleteCommand1.Connection = this.sqlConnection1;
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_CustomerID", System.Data.SqlDbType.VarChar, 6, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "CustomerID", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_BillingAddress1", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "BillingAddress1", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_BillingAddress2", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "BillingAddress2", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_BillingAddressCity", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "BillingAddressCity", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_BillingAddressState", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "BillingAddressState", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_CustomerName", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "CustomerName", System.Data.DataRowVersion.Original, null));
//
// sqlConnection1
//
this.sqlConnection1.ConnectionString = "data source=YS-D185;initial catalog=BookersDB;integrated security=SSPI;persist se" +
"curity info=True;workstation id=YS-D185;packet size=4096";
//
// sqlDataAdapter1
//
this.sqlDataAdapter1.DeleteCommand = this.sqlDeleteCommand1;
this.sqlDataAdapter1.InsertCommand = this.sqlInsertCommand1;
this.sqlDataAdapter1.SelectCommand = this.sqlSelectCommand1;
this.sqlDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table", "BookerCustDetails", new System.Data.Common.DataColumnMapping[] {
new System.Data.Common.DataColumnMapping("CustomerID", "CustomerID"),
new System.Data.Common.DataColumnMapping("CustomerName", "CustomerName"),
new System.Data.Common.DataColumnMapping("BillingAddress1", "BillingAddress1"),
new System.Data.Common.DataColumnMapping("BillingAddress2", "BillingAddress2"),
new System.Data.Common.DataColumnMapping("BillingAddressCity", "BillingAddressCity"),
new System.Data.Common.DataColumnMapping("BillingAddressState", "BillingAddressState")})});
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -