⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 productsdataset.designer.cs

📁 Microsoft Mobile Development Handbook的代码,有C#,VB,C++的
💻 CS
📖 第 1 页 / 共 5 页
字号:
        }
        
        public class ProductRowChangeEvent : System.EventArgs {
            
            private ProductRow eventRow;
            
            private System.Data.DataRowAction eventAction;
            
            [System.Diagnostics.DebuggerNonUserCodeAttribute()]
            public ProductRowChangeEvent(ProductRow row, System.Data.DataRowAction action) {
                this.eventRow = row;
                this.eventAction = action;
            }
            
            [System.Diagnostics.DebuggerNonUserCodeAttribute()]
            public ProductRow Row {
                get {
                    return this.eventRow;
                }
            }
            
            [System.Diagnostics.DebuggerNonUserCodeAttribute()]
            public System.Data.DataRowAction Action {
                get {
                    return this.eventAction;
                }
            }
        }
        
        public class ProductCategoryRowChangeEvent : System.EventArgs {
            
            private ProductCategoryRow eventRow;
            
            private System.Data.DataRowAction eventAction;
            
            [System.Diagnostics.DebuggerNonUserCodeAttribute()]
            public ProductCategoryRowChangeEvent(ProductCategoryRow row, System.Data.DataRowAction action) {
                this.eventRow = row;
                this.eventAction = action;
            }
            
            [System.Diagnostics.DebuggerNonUserCodeAttribute()]
            public ProductCategoryRow Row {
                get {
                    return this.eventRow;
                }
            }
            
            [System.Diagnostics.DebuggerNonUserCodeAttribute()]
            public System.Data.DataRowAction Action {
                get {
                    return this.eventAction;
                }
            }
        }
    }
}
namespace MobileDevelopersHandbook.ProductsDataSetTableAdapters {
    
    
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.ComponentModel.DataObjectAttribute(true)]
    public partial class ProductTableAdapter : System.ComponentModel.Component {
        
        private System.Data.SqlServerCe.SqlCeDataAdapter _adapter;
        
        private System.Data.SqlServerCe.SqlCeConnection _connection;
        
        private System.Data.SqlServerCe.SqlCeCommand[] _commandCollection;
        
        private bool _clearBeforeFill;
        
        [System.Diagnostics.DebuggerNonUserCodeAttribute()]
        public ProductTableAdapter() {
            this.ClearBeforeFill = true;
        }
        
        [System.Diagnostics.DebuggerNonUserCodeAttribute()]
        private System.Data.SqlServerCe.SqlCeDataAdapter Adapter {
            get {
                if ((this._adapter == null)) {
                    this.InitAdapter();
                }
                return this._adapter;
            }
        }
        
        [System.Diagnostics.DebuggerNonUserCodeAttribute()]
        internal System.Data.SqlServerCe.SqlCeConnection Connection {
            get {
                if ((this._connection == null)) {
                    this.InitConnection();
                }
                return this._connection;
            }
            set {
                this._connection = value;
                if ((this.Adapter.InsertCommand != null)) {
                    this.Adapter.InsertCommand.Connection = value;
                }
                if ((this.Adapter.DeleteCommand != null)) {
                    this.Adapter.DeleteCommand.Connection = value;
                }
                if ((this.Adapter.UpdateCommand != null)) {
                    this.Adapter.UpdateCommand.Connection = value;
                }
                for (int i = 0; (i < this.CommandCollection.Length); i = (i + 1)) {
                    if ((this.CommandCollection[i] != null)) {
                        ((System.Data.SqlServerCe.SqlCeCommand)(this.CommandCollection[i])).Connection = value;
                    }
                }
            }
        }
        
        [System.Diagnostics.DebuggerNonUserCodeAttribute()]
        protected System.Data.SqlServerCe.SqlCeCommand[] CommandCollection {
            get {
                if ((this._commandCollection == null)) {
                    this.InitCommandCollection();
                }
                return this._commandCollection;
            }
        }
        
        [System.Diagnostics.DebuggerNonUserCodeAttribute()]
        public bool ClearBeforeFill {
            get {
                return this._clearBeforeFill;
            }
            set {
                this._clearBeforeFill = value;
            }
        }
        
        [System.Diagnostics.DebuggerNonUserCodeAttribute()]
        private void InitAdapter() {
            this._adapter = new System.Data.SqlServerCe.SqlCeDataAdapter();
            System.Data.Common.DataTableMapping tableMapping = new System.Data.Common.DataTableMapping();
            tableMapping.SourceTable = "Table";
            tableMapping.DataSetTable = "Product";
            tableMapping.ColumnMappings.Add("ProductID", "ProductID");
            tableMapping.ColumnMappings.Add("Name", "Name");
            tableMapping.ColumnMappings.Add("Color", "Color");
            tableMapping.ColumnMappings.Add("ListPrice", "ListPrice");
            tableMapping.ColumnMappings.Add("Size", "Size");
            tableMapping.ColumnMappings.Add("ProductCategoryID", "ProductCategoryID");
            this._adapter.TableMappings.Add(tableMapping);
            this._adapter.DeleteCommand = new System.Data.SqlServerCe.SqlCeCommand();
            this._adapter.DeleteCommand.Connection = this.Connection;
            this._adapter.DeleteCommand.CommandText = "DELETE FROM [Product] WHERE (([ProductID] = @p1))";
            this._adapter.DeleteCommand.CommandType = System.Data.CommandType.Text;
            System.Data.SqlServerCe.SqlCeParameter param = new System.Data.SqlServerCe.SqlCeParameter();
            param.ParameterName = "@p1";
            param.DbType = System.Data.DbType.Int32;
            param.IsNullable = true;
            param.SourceColumn = "ProductID";
            param.SourceVersion = System.Data.DataRowVersion.Original;
            this._adapter.DeleteCommand.Parameters.Add(param);
            this._adapter.InsertCommand = new System.Data.SqlServerCe.SqlCeCommand();
            this._adapter.InsertCommand.Connection = this.Connection;
            this._adapter.InsertCommand.CommandText = "INSERT INTO [Product] ([Name], [Color], [ListPrice], [Size], [ProductCategoryID])" +
                " VALUES (@p1, @p2, @p3, @p4, @p5)";
            this._adapter.InsertCommand.CommandType = System.Data.CommandType.Text;
            param = new System.Data.SqlServerCe.SqlCeParameter();
            param.ParameterName = "@p1";
            param.IsNullable = true;
            param.SourceColumn = "Name";
            this._adapter.InsertCommand.Parameters.Add(param);
            param = new System.Data.SqlServerCe.SqlCeParameter();
            param.ParameterName = "@p2";
            param.IsNullable = true;
            param.SourceColumn = "Color";
            this._adapter.InsertCommand.Parameters.Add(param);
            param = new System.Data.SqlServerCe.SqlCeParameter();
            param.ParameterName = "@p3";
            param.DbType = System.Data.DbType.Currency;
            param.IsNullable = true;
            param.SourceColumn = "ListPrice";
            this._adapter.InsertCommand.Parameters.Add(param);
            param = new System.Data.SqlServerCe.SqlCeParameter();
            param.ParameterName = "@p4";
            param.IsNullable = true;
            param.SourceColumn = "Size";
            this._adapter.InsertCommand.Parameters.Add(param);
            param = new System.Data.SqlServerCe.SqlCeParameter();
            param.ParameterName = "@p5";
            param.DbType = System.Data.DbType.Int32;
            param.IsNullable = true;
            param.SourceColumn = "ProductCategoryID";
            this._adapter.InsertCommand.Parameters.Add(param);
            this._adapter.UpdateCommand = new System.Data.SqlServerCe.SqlCeCommand();
            this._adapter.UpdateCommand.Connection = this.Connection;
            this._adapter.UpdateCommand.CommandText = "UPDATE [Product] SET [Name] = @p1, [Color] = @p2, [ListPrice] = @p3, [Size] = @p4" +
                ", [ProductCategoryID] = @p5 WHERE (([ProductID] = @p6))";
            this._adapter.UpdateCommand.CommandType = System.Data.CommandType.Text;
            param = new System.Data.SqlServerCe.SqlCeParameter();
            param.ParameterName = "@p1";
            param.IsNullable = true;
            param.SourceColumn = "Name";
            this._adapter.UpdateCommand.Parameters.Add(param);
            param = new System.Data.SqlServerCe.SqlCeParameter();
            param.ParameterName = "@p2";
            param.IsNullable = true;
            param.SourceColumn = "Color";
            this._adapter.UpdateCommand.Parameters.Add(param);
            param = new System.Data.SqlServerCe.SqlCeParameter();
            param.ParameterName = "@p3";
            param.DbType = System.Data.DbType.Currency;
            param.IsNullable = true;
            param.SourceColumn = "ListPrice";
            this._adapter.UpdateCommand.Parameters.Add(param);
            param = new System.Data.SqlServerCe.SqlCeParameter();
            param.ParameterName = "@p4";
            param.IsNullable = true;
            param.SourceColumn = "Size";
            this._adapter.UpdateCommand.Parameters.Add(param);
            param = new System.Data.SqlServerCe.SqlCeParameter();
            param.ParameterName = "@p5";
            param.DbType = System.Data.DbType.Int32;
            param.IsNullable = true;
            param.SourceColumn = "ProductCategoryID";
            this._adapter.UpdateCommand.Parameters.Add(param);
            param = new System.Data.SqlServerCe.SqlCeParameter();
            param.ParameterName = "@p6";
            param.DbType = System.Data.DbType.Int32;
            param.IsNullable = true;
            param.SourceColumn = "ProductID";
            param.SourceVersion = System.Data.DataRowVersion.Original;
            this._adapter.UpdateCommand.Parameters.Add(param);
        }
        
        [System.Diagnostics.DebuggerNonUserCodeAttribute()]
        private void InitConnection() {
            this._connection = new System.Data.SqlServerCe.SqlCeConnection();
            this._connection.ConnectionString = ("Data Source =" 
                        + (System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) 
                        + ("\\MyDatabase.sdf;" 
                        + ("Password =" + "\"MobileP@ssw0rd\";"))));
        }
        
        [System.Diagnostics.DebuggerNonUserCodeAttribute()]
        private void InitCommandCollection() {
            this._commandCollection = new System.Data.SqlServerCe.SqlCeCommand[1];
            this._commandCollection[0] = new System.Data.SqlServerCe.SqlCeCommand();
            this._commandCollection[0].Connection = this.Connection;
            this._commandCollection[0].CommandText = "SELECT [ProductID], [Name], [Color], [ListPrice], [Size], [ProductCategoryID] FRO" +
                "M [Product]";
            this._commandCollection[0].CommandType = System.Data.CommandType.Text;
        }
        
        [System.Diagnostics.DebuggerNonUserCodeAttribute()]
        [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Fill, true)]
        public virtual int Fill(ProductsDataSet.ProductDataTable dataTable) {
            this.Adapter.SelectCommand = this.CommandCollection[0];
            if ((this.ClearBeforeFill == true)) {
                dataTable.Clear();
            }
            int returnValue = this.Adapter.Fill(dataTable);
            return returnValue;
        }
        
        [System.Diagnostics.DebuggerNonUserCodeAttribute()]
        [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select, true)]
        public virtual ProductsDataSet.ProductDataTable GetData() {
            this.Adapter.SelectCommand = this.CommandCollection[0];
            ProductsDataSet.ProductDataTable dataTable = new ProductsDataSet.ProductDataTable();
            this.Adapter.Fill(dataTable);
            return dataTable;
        }
        
        [System.Diagnostics.DebuggerNonUserCodeAttribute()]
        public virtual int Update(ProductsDataSet.ProductDataTable dataTable) {
            return this.Adapter.Update(dataTable);
        }
        
        [System.Diagnostics.DebuggerNonUserCodeAttribute()]
        public virtual int Update(ProductsDataSet dataSet) {
            return this.Adapter.Update(dataSet, "Product");

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -