.NET increase

xiaoxiao2021-03-06  13

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;

A summary description of Namespace WebApplication2 {///

/// WebForm1. /// public class WebForm1: System.Web.UI.Page {protected System.Web.UI.WebControls.DataGrid DataGrid1; protected System.Data.SqlClient.SqlConnection sqlConnection1; protected WebApplication2.DataSet1 dataSet11; 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.SqlDataAdapter sqlDataAdapter1; private void Page_Load (Object sender, system.eventargs e) {// Place the user code here to initialize the page if (! this.ispostback) {sqldataadapter1.fill (DataSet11); DataGrid1.dataBind ();}}

#Region Web Form Designer Generated Code Override Protected Void OnNit (Eventargs E) {// // Codegen: This call is required for the ASP.NET Web Form Designer. // InitializeComponent (); base.onit (e);} ///

/// Designer Supports the required method - Do not use the code editor to modify the // / this method.

/// private void InitializeComponent () {this.sqlConnection1 = new System.Data.SqlClient.SqlConnection (); this.sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter (); this.sqlDeleteCommand1 = new System. Data.SqlClient.SqlCommand (); this.sqlInsertCommand1 = new System.Data.SqlClient.SqlCommand (); this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand (); this.sqlUpdateCommand1 = new System.Data.SqlClient.SqlCommand (); this.dataSet11 = new WebApplication2.DataSet1 ();. ((System.ComponentModel.ISupportInitialize) (this.dataSet11)) BeginInit (); this.DataGrid1.PageIndexChanged = new System.Web.UI.WebControls.DataGridPageChangedEventHandler (this.DataGrid1_PageIndexChanged); this.DataGrid1.CancelCommand = new System.Web.UI.WebControls.DataGridCommandEventHandler (this.DataGrid1_CancelCommand); this.DataGrid1.EditCommand = new System.Web.UI.WebControls.DataGridCommandEventHandler (this.DataGrid1_EditCommand This.DataGrid1.UpdateCommand = ne w System.Web.UI.WebControls.DataGridCommandEventHandler (this.DataGrid1_UpdateCommand); this.DataGrid1.DeleteCommand = new System.Web.UI.WebControls.DataGridCommandEventHandler (this.DataGrid1_DeleteCommand); this.DataGrid1.SelectedIndexChanged = new System.EventHandler (this.DataGrid1_SelectedIndexChanged); // // sqlConnection1 // this.sqlConnection1.ConnectionString = "workstation id = /" ENG-HKZHOU / "; packet size = 4096; user id = sa; data source = /" ENG-FENGGUO / " "; Persist security info = false; initial catalog = northwind "; this.sqlConnection1.infomessage =

new System.Data.SqlClient.SqlInfoMessageEventHandler (this.sqlConnection1_InfoMessage); // // 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", "Customers", new System.Data.Common.DataColumnMapping [] {new System .Data.Common.DataColumnMapping ( "CustomerID", "CustomerID"), new System.Data.Common.DataColumnMapping ( "CompanyName", "CompanyName"), new System.Data.Common.DataColumnMapping ( "ContactName", "ContactName" ), New system.data.common.datacolumnmapi Ng ("ContactTitle", "ContactTitTitle"), new system.data.common.datacolumnmapping ("address", "address"), new system.data.common.Datacolumnmapping ("city", "city"), new system. Data.comMon.datacolumnMapping ("Region", "Region"), new system.data.common.datacolumnmapping ("Postalcode", "Postalcode"

), New system.data.common.Datacolumnmapping ("country", "country"), new system.data.common.DatacolumnMapping ("Phone", "Phone"), new system.data.common.DatacolumnMapping ("fax" , "Fax")})}); this.sqlDataAdapter1.UpdateCommand = this.sqlUpdateCommand1; this.sqlDataAdapter1.RowUpdated = new System.Data.SqlClient.SqlRowUpdatedEventHandler (this.sqlDataAdapter1_RowUpdated); // // sqlDeleteCommand1 // this. sqlDeleteCommand1.CommandText = @ "DELETE FROM Customers WHERE (CustomerID = @Original_CustomerID) AND (Address = @Original_Address OR @Original_Address IS NULL AND Address IS NULL) AND (City = @Original_City OR @Original_City IS NULL AND City IS NULL) AND ( CompanyNAME = @original_companyname) and (contactname = @original_contactname or @original_contactname is null and contactname is null) and (contactttitle = @original_ ContactTitle OR @Original_ContactTitle IS NULL AND ContactTitle IS NULL) AND (Country = @Original_Country OR @Original_Country IS NULL AND Country IS NULL) AND (Fax = @Original_Fax OR @Original_Fax IS NULL AND Fax IS NULL) AND (Phone = @Original_Phone OR @Original_Phone IS NULL AND Phone IS NULL) AND (PostalCode = @Original_PostalCode OR @Original_PostalCode IS NULL AND PostalCode IS NULL) AND (Region = @Original_Region OR @Original_Region IS NULL AND Region IS NULL) "; this.sqlDeleteCommand1.Connection = this . SqlConnection1;

this.sqlDeleteCommand1.Parameters.Add (new System.Data.SqlClient.SqlParameter ( "@ Original_CustomerID", System.Data.SqlDbType.NVarChar, 5, System.Data.ParameterDirection.Input, false, ((System.Byte) (0 )), ("Customerid", System.Data.DataRowVersion.original, null); this.sqldeleteCommand1.Parameters.add (new system.data.sqlclient.sqlparameter ("@ original_address ", System.data.sqldbtype.nvarchar, 60, system.data.parameterDirection.input, false, ((System.byte)), ((System.byte) (0))," Address ", System. Data.DataRowVersion.Original, null)); this.sqlDeleteCommand1.Parameters.Add (new System.Data.SqlClient.SqlParameter ( "@ Original_City", System.Data.SqlDbType.NVarChar, 15, System.Data.ParameterDirection.Input, False, ((System.byte) ((System.byte) (0)), "City", System.Data.DataRowVersion.original, Null); this.sqldeleteCommand1.Parameters.Add (New System) .DATA.SQLCLIENT.SQLPARAMETER ("@ Original_companyName", System.Data.Sqldbtype.Nvarchar, 40, System.Data.ParameterDirection.i NPUT, FALSE, ((System.byte) ((System.byte) (0)), "CompanyName", System.Data.DataRowVersion.Riginal, Null); this.sqldeleteCommand1.Parameters.Add ( new System.Data.SqlClient.SqlParameter ( "@ Original_ContactName", System.Data.SqlDbType.NVarChar, 30, System.Data.ParameterDirection.Input, false, ((System.Byte) (0)), ((System.Byte ) (0)), "ContactName", System.Data.DataRowVersion.Original, null)); this.sqlDeleteCommand1.Parameters.Add (new System.Data.SqlClient.SqlParameter ( "@ Original_ContactTitle", System.Data.SqlDbType. NVARCHAR, 30, System.Data.ParameterDirection.Input, false, ((System.byte) ((System.byte) (0)), "

ContactTitle ", System.Data.DataRowVersion.Original, null)); this.sqlDeleteCommand1.Parameters.Add (new System.Data.SqlClient.SqlParameter (" @ Original_Country ", System.Data.SqlDbType.NVarChar, 15, System.Data .ParameterDirection.input, false (0)), ((System.byte) (0)), "Country", System.Data.DataRowVersion.original, Null); this.sqldeleteCommand1.Parameters .Add (new system.data.sqlclient.sqlparameter ("@ original_fax", system.data.sqldbtype.nvarchar, 24, system.data.parameterDirection.input, false, ((System.byte) (0)), System.byte) (0)), "fax", system.data.datarowversion.original, null); this.sqldeleteCommand1.parameters.add (new system.data.sqlclient.sqlparameter ("@ Original_Phone", System.Data . Sqldbtype.nvarchar, 24, System.Data.ParameterDirection.Input, False, (System.byte) ((System.byte) (0)), "Phone", System.Data.DataRowVersion.original , null); this.sqldeleteCommand1.Parameters.add (new system.data.sqlclient.sqlparameter ("@ Original_Postalcode", System.Data.sqldbt Ype.nvarchar, 10, System.Data.ParameterDirection.Input, False, ((System.byte) ((System.byte) (0)), "Postalcode", System.Data.DataRowVersion.ORIGINAL, null)); this.sqlDeleteCommand1.Parameters.Add (new System.Data.SqlClient.SqlParameter ( "@ Original_Region", System.Data.SqlDbType.NVarChar, 15, System.Data.ParameterDirection.Input, false, ((System. (0)), ((System.byte) (0)), "Region", System.Data.DataRowVersion.original, Null); // // SqlinsertCommand1 // this.sqlinsertCommand1.comMandText = @ "

INSERT INTO Customers (CustomerID, CompanyName, ContactName, ContactTitle, Address, City, Region, PostalCode, Country, Phone, Fax) VALUES (@CustomerID, @CompanyName, @ContactName, @ContactTitle, @Address, @City, @Region, @ PostalCode, @Country, @Phone, @Fax); SELECT CustomerID, CompanyName, ContactName, ContactTitle, Address, City, Region, PostalCode, Country, Phone, Fax FROM Customers WHERE (CustomerID = @CustomerID) "; this.sqlInsertCommand1.Connection = this.sqlConnection1; this.sqlInsertCommand1.Parameters.Add (new System.Data.SqlClient.SqlParameter ( "@ CustomerID", System.Data.SqlDbType.NVarChar, 5, "CustomerID")); this.sqlInsertCommand1.Parameters.Add (new System.Data.SqlClient.SqlParameter ( "@ CompanyName", System.Data.SqlDbType.NVarChar, 40, "CompanyName")); this.sqlInsertCommand1.Parameters.Add (new System.Data.SqlClient.SqlParameter ( "@ ContactName ", system.data.sqldbtype.nvarchar, 30," contactname ")); this.sqlinsertcommand1.parameters.add (new system.data.sqlclient.sqlparameter ( "@ContactTitle", System.Data.SqlDbType.NVarChar, 30, "ContactTitle")); this.sqlInsertCommand1.Parameters.Add (new System.Data.SqlClient.SqlParameter ( "@ Address", System.Data.SqlDbType. NVARCHAR, 60, "Address"); this.sqlinsertcommand1.parameters.add (new system.data.sqlclient.sqlparameter ("@ City", system.data.sqldbtype.nvarchar, 15, "city"); this. SqlinsertCommand1.Parameters.add (new system.data.sqlclient.sqlparameter ("@ region", system.data.sqldbtype.nvarchar, 15, "region"));

this.sqlInsertCommand1.Parameters.Add (new System.Data.SqlClient.SqlParameter ( "@ PostalCode", System.Data.SqlDbType.NVarChar, 10, "PostalCode")); this.sqlInsertCommand1.Parameters.Add (new System.Data .SqlClient.SqlParameter ( "@ Country", System.Data.SqlDbType.NVarChar, 15, "Country")); this.sqlInsertCommand1.Parameters.Add (new System.Data.SqlClient.SqlParameter ( "@ Phone", System. Data.sqldbtype.nvarchar, 24, "phone"); this.sqlinsertcommand1.parameters.add (new system.data.sqlclient.sqlparameter ("@ fax", system.data.sqldbtype.nvarchar, 24, "fax") ); // // sqlSelectCommand1 // this.sqlSelectCommand1.CommandText = "SELECT CustomerID, CompanyName, ContactName, ContactTitle, Address, City, Region," "PostalCode, Country, Phone, Fax FROM Customers"; this.sqlSelectCommand1.Connection = this.sqlConnection1; // // sqlupdateCommand1 // this.sqlupdateCommand1.commandtext = @ "Update Customers Set Customerid = @customerid, CompanyName = @companyname, ContactName = @Contactna me, ContactTitle = @ContactTitle, Address = @Address, City = @City, Region = @Region, PostalCode = @PostalCode, Country = @Country, Phone = @Phone, Fax = @Fax WHERE (CustomerID = @Original_CustomerID) AND ( Address = @Original_Address OR @Original_Address IS NULL AND Address IS NULL) AND (City = @Original_City OR @Original_City IS NULL AND City IS NULL) AND (CompanyName = @Original_CompanyName) AND (ContactName = @Original_ContactName OR @

Original_ContactName IS NULL AND ContactName IS NULL) AND (ContactTitle = @Original_ContactTitle OR @Original_ContactTitle IS NULL AND ContactTitle IS NULL) AND (Country = @Original_Country OR @Original_Country IS NULL AND Country IS NULL) AND (Fax = @Original_Fax OR @Original_Fax IS NULL AND Fax IS NULL) AND (Phone = @Original_Phone OR @Original_Phone IS NULL AND Phone IS NULL) AND (PostalCode = @Original_PostalCode OR @Original_PostalCode IS NULL AND PostalCode IS NULL) AND (Region = @Original_Region OR @Original_Region IS NULL AND Region IS NULL); SELECT CustomerID, CompanyName, ContactName, ContactTitle, Address, City, Region, PostalCode, Country, Phone, Fax FROM Customers WHERE (CustomerID = @CustomerID) "; this.sqlUpdateCommand1.Connection = this.sqlConnection1; this. sqlUpdateCommand1.Parameters.Add (new System.Data.SqlClient.SqlParameter ( "@ CustomerID", System.Data.SqlDbType.NVarChar, 5, "CustomerID")); this.sqlUpdateCommand1.Parameters.Add (new System.Data.SqlClient .Sqlparame ter ( "@ CompanyName", System.Data.SqlDbType.NVarChar, 40, "CompanyName")); this.sqlUpdateCommand1.Parameters.Add (new System.Data.SqlClient.SqlParameter ( "@ ContactName", System.Data.SqlDbType .Nvarchar, 30, "contactname"); this.sqlupdateCommand1.Parameters.add (new system.data.sqlclient.sqlparameter ("@ contacttitle", system.data.sqldbtype.nvarchar, 30, "contactttitle"); this . SqlupdateCommand1.Parameters.add (new system.data.sqlclient.sqlparameter ("@ address", system.data.sqldbtype.nvarchar, 60, "address"));

this.sqlUpdateCommand1.Parameters.Add (new System.Data.SqlClient.SqlParameter ( "@ City", System.Data.SqlDbType.NVarChar, 15, "City")); this.sqlUpdateCommand1.Parameters.Add (new System.Data .SqlClient.SqlParameter ( "@ Region", System.Data.SqlDbType.NVarChar, 15, "Region")); this.sqlUpdateCommand1.Parameters.Add (new System.Data.SqlClient.SqlParameter ( "@ PostalCode", System. Data.SqlDbType.NVarChar, 10, "PostalCode")); this.sqlUpdateCommand1.Parameters.Add (new System.Data.SqlClient.SqlParameter ( "@ Country", System.Data.SqlDbType.NVarChar, 15, "Country") ); this.sqlUpdateCommand1.Parameters.Add (new System.Data.SqlClient.SqlParameter ( "@ Phone", System.Data.SqlDbType.NVarChar, 24, "Phone")); this.sqlUpdateCommand1.Parameters.Add (new System .Data.SqlClient.SqlParameter ( "@ Fax", System.Data.SqlDbType.NVarChar, 24, "Fax")); this.sqlUpdateCommand1.Parameters.Add (new System.Data.SqlClient.SqlParameter ( "@ Original_CustomerID", System.data.sqldbtype.nvarchar, 5, system.data.parameterDirection.input, False, ((System.byte) ((System.byte) (0)), "Customerid", System.Data.DataRowVersion.original, Null); this.sqlupdateCommand1.Parameters.Add (New System) .Data.sqlclient.sqlparameter ("@ Original_Address", System.Data.sqldbtype.nvarchar, 60, System.Data.ParameterDirection.Input, False, ((System.byte)) ((System.byte) 0), "address", system.data.datarowversion.original, null); this.sqlupdateCommand1.parameters.add (new system.data.sqlclient.sqlparameter ("@ Original_city"

System.data.sqldbtype.nvarchar, 15, system.data.parameterDirection.Input, false, ((System.byte) ((System.byte) (0)), "City", System.Data .DataRowVersion.Original, null)); this.sqlUpdateCommand1.Parameters.Add (new System.Data.SqlClient.SqlParameter ( "@ Original_CompanyName", System.Data.SqlDbType.NVarChar, 40, System.Data.ParameterDirection.Input, false ((System.byte) (0)), "CompanyName", System.Data.DataRowVersion.ORIGINAL, NULL); this.sqlupdateCommand1.Parameters.Add (New System. Data.Sqlclient.sqlparameter ("@ Original_ContactName", System.Data.sqldbtype.nvarchar, 30, System.Data.ParameterDirection.Input, False, ((System.byte) ((System.byte) (0) (bTem.byte) )), "ContactName", System.Data.DataRowVersion.Original, null)); this.sqlUpdateCommand1.Parameters.Add (new System.Data.SqlClient.SqlParameter ( "@ Original_ContactTitle", System.Data.SqlDbType.NVarChar, 30 System.data.ParameterDirection.input, False, ((System.byte) (0)), "ContactTitle", System.Data. DataRowVersion.Original, null)); this.sqlUpdateCommand1.Parameters.Add (new System.Data.SqlClient.SqlParameter ( "@ Original_Country", System.Data.SqlDbType.NVarChar, 15, System.Data.ParameterDirection.Input, false, ((System.byte) ((System.byte) (0)), "Country", System.Data.DataRowVersion.original, Null); this.sqlupdateCommand1.Parameters.Add (New System.Data) . Sqlclient.sqlparameter ("@ Original_fax", System.Data.sqldbtype.Nvarchar, 24, System.Data.ParameterDirection.Input, False, ((System.byte)) ((System.byte) (0) ), "Fax", system.data.datarowversion.original, null);

this.sqlUpdateCommand1.Parameters.Add (new System.Data.SqlClient.SqlParameter ( "@ Original_Phone", System.Data.SqlDbType.NVarChar, 24, System.Data.ParameterDirection.Input, false, ((System.Byte) (0 )), (System.byte) (0)), "phone", system.data.datarowversion.original, null); this.sqlupdateCommand1.parameters.add (new system.data.sqlclient.sqlparameter) ", System.data.sqldbtype.nvarchar, 10, system.data.parameterDirection.input, false, ((System.byte) ((System.byte) (0))," Postalcode ", System. Data.DataRowVersion.Original, null)); this.sqlUpdateCommand1.Parameters.Add (new System.Data.SqlClient.SqlParameter ( "@ Original_Region", System.Data.SqlDbType.NVarChar, 15, System.Data.ParameterDirection.Input, False, ((System.byte) ((System.byte) (0)), "Region", System.Data.DataRowVersion.original, Null); /// DataSet11 // this.DataSet11 .Datasetname = "dataset1"; this.dataset11.locale = new system.globalization.cultureInfo ("zh-cn"); this.Load = new System.ev Enthandler (this.page_load); (this.DataSet11)). endinit ();} #ENDREGION

Private void sqldataadapter1_rowupdated (object sender, system.data.sqlclient.sqlrowupdatedEventArgs e) {}

Private void SqlConnection1_infomessage (Object sender, system.data.sqlclient.sqlinfomessageeventageeventagegs e) {}

private void DataGrid1_EditCommand (object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) {sqlDataAdapter1.Fill (dataSet11); DataGrid1.EditItemIndex = e.Item.ItemIndex; DataGrid1.DataBind ();}

private void DataGrid1_DeleteCommand (object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) {sqlDataAdapter1.Fill (dataSet11);. dataSet11.Customers.FindByCustomerID (DataGrid1.DataKeys [e.Item.ItemIndex] .ToString ()) Delete ( ); sqlDataAdapter1.Update (dataSet11); dataSet11.AcceptChanges (); DataGrid1.EditItemIndex = -1; DataGrid1.DataBind ();} private void DataGrid1_PageIndexChanged (object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e) {sqlDataAdapter1. Fill (DataSet11); DataGrid1.currentPageIndex = E.NewpageIndex; DataGrid1.dataBind ();

private void DataGrid1_UpdateCommand (object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) {sqlDataAdapter1.Fill (dataSet11); DataRow dr = dataSet11.Customers.FindByCustomerID (DataGrid1.DataKeys [e.Item.ItemIndex] .ToString ()) For (int i = 0; I

private void DataGrid1_CancelCommand (object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) {sqlDataAdapter1.Fill (dataSet11); DataGrid1.EditItemIndex = -1; DataGrid1.DataBind ();}

Private void DataGrid1_selectedIndexchanged (Object Sender, System.EventArgs E) {}}}

转载请注明原文地址:https://www.9cbs.com/read-67649.html

New Post(0)