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

📄 exp7sql2dataset1.designer.cs

📁 WinCE系统的数据库操作示例
💻 CS
📖 第 1 页 / 共 4 页
字号:
                }
            }
        }
        
        [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 = "Employees";
            tableMapping.ColumnMappings.Add("Name", "Name");
            tableMapping.ColumnMappings.Add("Age", "Age");
            tableMapping.ColumnMappings.Add("Address", "Address");
            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 [Employees] WHERE (([Name] = @p1))";
            this._adapter.DeleteCommand.CommandType = System.Data.CommandType.Text;
            System.Data.SqlServerCe.SqlCeParameter param = new System.Data.SqlServerCe.SqlCeParameter();
            param.ParameterName = "@p1";
            param.IsNullable = true;
            param.SourceColumn = "Name";
            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 [Employees] ([Name], [Age], [Address]) VALUES (@p1, @p2, @p3)";
            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.DbType = System.Data.DbType.Int32;
            param.IsNullable = true;
            param.SourceColumn = "Age";
            this._adapter.InsertCommand.Parameters.Add(param);
            param = new System.Data.SqlServerCe.SqlCeParameter();
            param.ParameterName = "@p3";
            param.IsNullable = true;
            param.SourceColumn = "Address";
            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 [Employees] SET [Name] = @p1, [Age] = @p2, [Address] = @p3 WHERE (([Name] " +
                "= @p4))";
            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.DbType = System.Data.DbType.Int32;
            param.IsNullable = true;
            param.SourceColumn = "Age";
            this._adapter.UpdateCommand.Parameters.Add(param);
            param = new System.Data.SqlServerCe.SqlCeParameter();
            param.ParameterName = "@p3";
            param.IsNullable = true;
            param.SourceColumn = "Address";
            this._adapter.UpdateCommand.Parameters.Add(param);
            param = new System.Data.SqlServerCe.SqlCeParameter();
            param.ParameterName = "@p4";
            param.IsNullable = true;
            param.SourceColumn = "Name";
            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) + "\\exp7SQL2.sdf;"));
        }
        
        [System.Diagnostics.DebuggerNonUserCodeAttribute()]
        private void InitCommandCollection() {
            this._commandCollection = new System.Data.SqlServerCe.SqlCeCommand[6];
            this._commandCollection[0] = new System.Data.SqlServerCe.SqlCeCommand();
            this._commandCollection[0].Connection = this.Connection;
            this._commandCollection[0].CommandText = "SELECT [Name], [Age], [Address] FROM [Employees]";
            this._commandCollection[0].CommandType = System.Data.CommandType.Text;
            this._commandCollection[1] = new System.Data.SqlServerCe.SqlCeCommand();
            this._commandCollection[1].Connection = this.Connection;
            this._commandCollection[1].CommandText = "SELECT Name, Age, Address\r\nFROM Employees\r\nWHERE (Age = @PARAM1)";
            this._commandCollection[1].CommandType = System.Data.CommandType.Text;
            System.Data.SqlServerCe.SqlCeParameter param = new System.Data.SqlServerCe.SqlCeParameter();
            param.ParameterName = "@PARAM1";
            param.DbType = System.Data.DbType.Int32;
            param.Size = 4;
            param.IsNullable = true;
            param.SourceColumn = "Age";
            this._commandCollection[1].Parameters.Add(param);
            this._commandCollection[2] = new System.Data.SqlServerCe.SqlCeCommand();
            this._commandCollection[2].Connection = this.Connection;
            this._commandCollection[2].CommandText = "SELECT Name, Age, Address\r\nFROM Employees\r\nWHERE (Name = @PARAM1)";
            this._commandCollection[2].CommandType = System.Data.CommandType.Text;
            param = new System.Data.SqlServerCe.SqlCeParameter();
            param.ParameterName = "@PARAM1";
            param.Size = 100;
            param.IsNullable = true;
            param.SourceColumn = "Name";
            this._commandCollection[2].Parameters.Add(param);
            this._commandCollection[3] = new System.Data.SqlServerCe.SqlCeCommand();
            this._commandCollection[3].Connection = this.Connection;
            this._commandCollection[3].CommandText = "DELETE FROM Employees\r\nWHERE (Name = @PARAM)";
            this._commandCollection[3].CommandType = System.Data.CommandType.Text;
            param = new System.Data.SqlServerCe.SqlCeParameter();
            param.ParameterName = "@PARAM";
            param.Size = 100;
            param.IsNullable = true;
            param.SourceColumn = "Name";
            param.SourceVersion = System.Data.DataRowVersion.Original;
            this._commandCollection[3].Parameters.Add(param);
            this._commandCollection[4] = new System.Data.SqlServerCe.SqlCeCommand();
            this._commandCollection[4].Connection = this.Connection;
            this._commandCollection[4].CommandText = "INSERT INTO Employees\r\n      (Name, Age, Address)\r\nVALUES (@p1, @p2, @p3)";
            this._commandCollection[4].CommandType = System.Data.CommandType.Text;
            param = new System.Data.SqlServerCe.SqlCeParameter();
            param.ParameterName = "@p1";
            param.Size = 100;
            param.IsNullable = true;
            param.SourceColumn = "Name";
            this._commandCollection[4].Parameters.Add(param);
            param = new System.Data.SqlServerCe.SqlCeParameter();
            param.ParameterName = "@p2";
            param.DbType = System.Data.DbType.Int32;
            param.Size = 4;
            param.IsNullable = true;
            param.SourceColumn = "Age";
            this._commandCollection[4].Parameters.Add(param);
            param = new System.Data.SqlServerCe.SqlCeParameter();
            param.ParameterName = "@p3";
            param.Size = 100;
            param.IsNullable = true;
            param.SourceColumn = "Address";
            this._commandCollection[4].Parameters.Add(param);
            this._commandCollection[5] = new System.Data.SqlServerCe.SqlCeCommand();
            this._commandCollection[5].Connection = this.Connection;
            this._commandCollection[5].CommandText = "UPDATE Employees\r\nSET Name = @Name, Age = @Age, Address = @Address\r\nWHERE (Name =" +
                " @Param1)";
            this._commandCollection[5].CommandType = System.Data.CommandType.Text;
            param = new System.Data.SqlServerCe.SqlCeParameter();
            param.ParameterName = "@Name";
            param.Size = 100;
            param.IsNullable = true;
            param.SourceColumn = "Name";
            this._commandCollection[5].Parameters.Add(param);
            param = new System.Data.SqlServerCe.SqlCeParameter();
            param.ParameterName = "@Age";
            param.DbType = System.Data.DbType.Int32;
            param.Size = 4;
            param.IsNullable = true;
            param.SourceColumn = "Age";
            this._commandCollection[5].Parameters.Add(param);
            param = new System.Data.SqlServerCe.SqlCeParameter();
            param.ParameterName = "@Address";
            param.Size = 100;
            param.IsNullable = true;
            param.SourceColumn = "Address";
            this._commandCollection[5].Parameters.Add(param);
            param = new System.Data.SqlServerCe.SqlCeParameter();
            param.ParameterName = "@Param1";
            param.Size = 100;
            param.IsNullable = true;
            param.SourceColumn = "Name";
            param.SourceVersion = System.Data.DataRowVersion.Original;
            this._commandCollection[5].Parameters.Add(param);
        }
        
        [System.Diagnostics.DebuggerNonUserCodeAttribute()]
        [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Fill, true)]
        public virtual int Fill(exp7SQL2DataSet1.EmployeesDataTable 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 exp7SQL2DataSet1.EmployeesDataTable GetData() {
            this.Adapter.SelectCommand = this.CommandCollection[0];
            exp7SQL2DataSet1.EmployeesDataTable dataTable = new exp7SQL2DataSet1.EmployeesDataTable();
            this.Adapter.Fill(dataTable);
            return dataTable;
        }
        
        [System.Diagnostics.DebuggerNonUserCodeAttribute()]
        [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Fill, false)]
        public virtual int FillByAge(exp7SQL2DataSet1.EmployeesDataTable dataTable, System.Nullable<int> PARAM1) {
            this.Adapter.SelectCommand = this.CommandCollection[1];
            if ((PARAM1.HasValue == true)) {
                this.Adapter.SelectCommand.Parameters[0].Value = ((int)(PARAM1.Value));
            }
            else {
                this.Adapter.SelectCommand.Parameters[0].Value = System.DBNull.Value;
            }
            if ((this.ClearBeforeFill == true)) {
                dataTable.Clear();
            }
            int returnValue = this.Adapter.Fill(dataTable);
            return returnValue;
        }
        
        [System.Diagnostics.DebuggerNonUserCodeAttribute()]
        [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select, false)]
        public virtual exp7SQL2DataSet1.EmployeesDataTable GetDataByAge(System.Nullable<int> PARAM1) {
            this.Adapter.SelectCommand = this.CommandCollection[1];
            if ((PARAM1.HasValue == true)) {
                this.Adapter.SelectCommand.Parameters[0].Value = ((int)(PARAM1.Value));
            }
            else {
                this.Adapter.SelectCommand.Parameters[0].Value = System.DBNull.Value;
            }
            exp7SQL2DataSet1.EmployeesDataTable dataTable = new exp7SQL2DataSet1.EmployeesDataTable();
            this.Adapter.Fill(dataTable);
            return dataTable;
        }
        
        [System.Diagnostics.DebuggerNonUserCodeAttribute()]
        [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Fill, false)]
        public virtual int FillByName(exp7SQL2DataSet1.EmployeesDataTable dataTable, string PARAM1) {
            this.Adapter.SelectCommand = this.CommandCollection[2];
            if ((PARAM1 == null)) {
                throw new System.ArgumentNullException("PARAM1");
            }
            else {
                this.Adapter.SelectCommand.Parameters[0].Value = ((string)(PARAM1));
            }
            if ((this.ClearBeforeFill == true)) {
                dataTable.Clear();
            }
            int returnValue = this.Adapter.Fill(dataTable);
            return returnValue;
        }
        
        [System.Diagnostics.DebuggerNonUserCodeAttribute()]
        [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select, false)]
        public virtual exp7SQL2DataSet1.EmployeesDataTable GetDataByName(string PARAM1) {
            this.Adapter.SelectCommand = this.CommandCollection[2];
            if ((PARAM1 == null)) {
                throw new System.ArgumentNullException("PARAM1");
            }
            else {
                this.Adapter.SelectCommand.Parameters[0].Value = ((string)(PARAM1));
            }
            exp7SQL2DataSet1.EmployeesDataTable dataTable = new exp7SQL2DataSet1.EmployeesDataTable();

⌨️ 快捷键说明

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