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;
Namespace OOI_CN {///
#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);} ///
/// summary> private void InitializeComponent () {this.oleDbDataAdapter1 = new System.Data.OleDb.OleDbDataAdapter (); this.oleDbSelectCommand1 = new System.Data.OleDb.OleDbCommand (); this.oleDbInsertCommand1 = new System. Data.OleDb.OleDbCommand (); this.oleDbUpdateCommand1 = new System.Data.OleDb.OleDbCommand (); this.oleDbDeleteCommand1 = new System.Data.OleDb.OleDbCommand (); this.oleDbConnection1 = new System.Data.OleDb.OleDbConnection (); This.DataSet21 = new ioi_cn.dataset2 (); this.oledbcommand1 = new system.data.oledb.oledbcommand (); ("this.dataset21)). BeginInit (); // // oleDbDataAdapter1 // this.oleDbDataAdapter1.DeleteCommand = this.oleDbDeleteCommand1; this.oleDbDataAdapter1.InsertCommand = this.oleDbInsertCommand1; this.oleDbDataAdapter1.SelectCommand = this.oleDbSelectCommand1; this.oleDbDataAdapter1.TableMappings.AddRange (new System.Data.Common. DataTableMapping [] {New Sy Stem.data.comMon.DataTableMapping ("Table", "SOCUT_BBS", new system.data.common.datableumnmapping [] {new system.data.common.DatacolumnMApping ("ID", "ID"), new system.data.. Common.DataColumnMapping ( "Content", "Content"), new System.Data.Common.DataColumnMapping ( "Poster", "Poster")})}); this.oleDbDataAdapter1.UpdateCommand = this.oleDbUpdateCommand1; // // oleDbSelectCommand1 // this.oledbselectcommand1.commandtext = "
SELECT ID, Content, Poster FROM Socut_BBS ORDER BY ID DESC "; this.oleDbSelectCommand1.Connection = this.oleDbConnection1; // // oleDbInsertCommand1 // this.oleDbInsertCommand1.CommandText =" INSERT INTO Socut_BBS (Content, Poster) VALUES (,? ?) "; this.oleDbInsertCommand1.Connection = this.oleDbConnection1; this.oleDbInsertCommand1.Parameters.Add (new System.Data.OleDb.OleDbParameter (" Content ", System.Data.OleDb.OleDbType.VarWChar, 0," Content " ))); This.oledbinsertcommand1.Parameters.add (new system.data.oledb.oledbParameter ("poster", system.data.oledb.oledbtype.varwchar, 50, "poster")); /// OledbupdateCommand1 // this .oleDbUpdateCommand1.CommandText = "UPDATE Socut_BBS SET Content =, Poster = WHERE (ID =?) AND (Poster = OR????" "IS NULL AND Poster IS NULL)"; this.oleDbUpdateCommand1.Connection = this.oleDbConnection1 This.oledbupdateCommand1.Parameters.Add (new system.data.oledb.oledbParameter ("content", system.data.oledb.oledbtype.varwchar, 0, "Content")); this.oleDbUpdateCommand1.Parameters.Add (new System.Data.OleDb.OleDbParameter ( "Poster", System.Data.OleDb.OleDbType.VarWChar, 50, "Poster")); this.oleDbUpdateCommand1.Parameters .Add (new system.data.oledb.oledbParameter ("Original_ID", System.Data.Oledb.oledbtype.integer, 0, System.Data.ParameterDirection.Input, False, ((System.byte)), ((0)), (0)) (0)), "ID", system.data.datarowversion.original, null); this.oledbupdateCommand1.Parameters.add (new system.data.oledb.oledbparameter ("Original_poster"
System.Data.oledb.oledbtype.varwchar, 50, system.data.parameterDirection.input, false, ((System.byte) ((System.byte)), "Poster", System .Data.DataRowVersion.Original, null)); this.oleDbUpdateCommand1.Parameters.Add (new System.Data.OleDb.OleDbParameter ( "Original_Poster1", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection. Input, False ((System.byte) ((System.byte) (0)), "Poster", System.Data.DataRowVersion.original, Null); //////////////i t t .oleDbDeleteCommand1.CommandText = "DELETE FROM Socut_BBS WHERE (? ID =) AND (Poster = OR IS NULL AND Poster IS N??" "ULL)"; this.oleDbDeleteCommand1.Connection = this.oleDbConnection1; this.oleDbDeleteCommand1.Parameters .Add (new system.data.oledb.oledbParameter ("Original_ID", System.Data.Oledb.oledbtype.integer, 0, System.Data.ParameterDirection.Input, False, ((System.byte)), ((0)), (0)), "ID", system.data.datarowversion.original, null); this.OleDbdeleteCommand1. Parameters.Add (New System.Data.Oledb.oledbParameter ("Original_poster", System.Data.Oledb.oledbtype.varwchar, 50, System.Data.ParameterDirection.Input, False, ((System.byte)), ((System.byte) (0)), "Poster", System.Data.DataRowVersion.original, Null); this.OleDbdeleteCommand1.Parameters.Add (New System.Data.OleDb.OleDbParameter ("Original_Poster1", System. Data.oledb.oledbtype.varwchar, 50, System.Data.ParameterDirection.Input, False, ((System.byte) ((System.byte)), "Poster", System.Data. DataRowVersion.original, null); // // oledbconnection1 // this.OleDbconnection1.connectionstring = @ "
Jet OLEDB: Global Partial Bulk Ops = 2; Jet OLEDB: Registry Path =; Jet OLEDB: Database Locking Mode = 1; Data Source = "F: /1Web/ooi_Cn/#OICn.mdb"; Jet OLEDB: Engine Type = 5; provider = "" microsoft.jet.oledb.4.0 ""; Jet OLEDB: system Database =; Jet OLEDB: SFP = false; persist security info = false; extended proties =; mode = share deny none; Jet OLEDB: Encrypt Database = False; Jet OLEDB: Create System Database = False; Jet OLEDB: Do not Copy Locale on Compact = False; Jet OLEDB: Compact Without Replica Repair = False; User ID = Admin; Jet OLEDB: Global Bulk Transactions = 1 "; // // dataset21 // this.dataset21.datasetName =" dataset2 "; this.dataset21.locale = new system.globalization.cultureInfo (" en-cn "); // // oledbcommand1 // this.OLEDbcommand1. Connection = this.oleDbConnection1; this.DataGrid1.DeleteCommand = new System.Web.UI.WebControls.DataGridCommandEventHandler (this.DataGrid1_DeleteCommand); this.Load = new System.EventHandler (this.Page_Load); ((System.ComponentModel. ISupportInitialize) (this.DataSet 21)). Endinit ();} #ENDREGION
Private void DataGrid1_EditCommand (Object Source, System.Web.ui.WebControls.DataGridCommandeventArgs E) {dataGrid1.edititemindex = E.Item.itemindex; DataGrid1.DATABIND ();
}
Private void DataGrid1_cancelcommand (Object Source, System.Web.ui.WebControls.DataGridCommandeventArgs E) {dataGrid1.edititemindex = -1; dataGrid1.databind ();
}
Private void DataGrid1_updateCommand (Object Source, System.DataGridCommandeventArgs E) {string key = dataGrid1.datakeys [E.Item.ItemIndex] .tostring ();
String Poster; TextBox TB; TB = (TextBox) E.Item.cells [2] .controls [0]; Poster = TB.Text; DSCategories.Socut_bbsrow r; r = dataset21.socut_bbs.findbyid (int.Parse) );
R.POSTER = POSTER;
OLEDBDATAADAPTER1.UPDATE (DataSet 21); DataGrid1.DATABIND ();
DataGrid1.edititemindex = -1;
DataGrid1.databind ();
private void DataGrid1_DeleteCommand (object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) {string delCmd = "delete from SOCUT_BBS where ID =" DataGrid1.DataKeys [(int) e.Item.ItemIndex] .ToString (); oleDbCommand1 .CommandText = delCmd; oleDbCommand1.Connection.Open (); oleDbCommand1.ExecuteNonQuery (); oleDbCommand1.Connection.Close (); oleDbDataAdapter1.Fill (dataSet21); DataGrid1.EditItemIndex = -1; DataGrid1.DataBind ();}}}