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

📄 prnttableadapter.cs

📁 学生入学信息
💻 CS
字号:
namespace cphoto.mydbDataSetTableAdapters
{
    using cphoto;
    using cphoto.Properties;
    using System;
    using System.CodeDom.Compiler;
    using System.ComponentModel;
    using System.ComponentModel.Design;
    using System.Data;
    using System.Data.Common;
    using System.Data.OleDb;
    using System.Diagnostics;

    [ToolboxItem(true), GeneratedCode("System.Data.Design.TypedDataSetGenerator", "2.0.0.0"), DesignerCategory("code"), Designer("Microsoft.VSDesigner.DataSource.Design.TableAdapterDesigner, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), HelpKeyword("vs.data.TableAdapter"), DataObject(true)]
    public class prntTableAdapter : Component
    {
        private OleDbDataAdapter _adapter;
        private bool _clearBeforeFill;
        private OleDbCommand[] _commandCollection;
        private OleDbConnection _connection;

        [DebuggerNonUserCode]
        public prntTableAdapter()
        {
            this.ClearBeforeFill = true;
        }

        [HelpKeyword("vs.data.TableAdapter"), DataObjectMethod(DataObjectMethodType.Fill, true), DebuggerNonUserCode]
        public virtual int Fill(mydbDataSet.prntDataTable dataTable)
        {
            this.Adapter.SelectCommand = this.CommandCollection[0];
            if (this.ClearBeforeFill)
            {
                dataTable.Clear();
            }
            return this.Adapter.Fill(dataTable);
        }

        [DebuggerNonUserCode, HelpKeyword("vs.data.TableAdapter"), DataObjectMethod(DataObjectMethodType.Select, true)]
        public virtual mydbDataSet.prntDataTable GetData()
        {
            this.Adapter.SelectCommand = this.CommandCollection[0];
            mydbDataSet.prntDataTable dataTable = new mydbDataSet.prntDataTable();
            this.Adapter.Fill(dataTable);
            return dataTable;
        }

        [DebuggerNonUserCode]
        private void InitAdapter()
        {
            this._adapter = new OleDbDataAdapter();
            DataTableMapping mapping = new DataTableMapping();
            mapping.SourceTable = "Table";
            mapping.DataSetTable = "prnt";
            mapping.ColumnMappings.Add("fd1", "fd1");
            mapping.ColumnMappings.Add("fd2", "fd2");
            mapping.ColumnMappings.Add("fd3", "fd3");
            mapping.ColumnMappings.Add("fd4", "fd4");
            this._adapter.TableMappings.Add(mapping);
            this._adapter.InsertCommand = new OleDbCommand();
            this._adapter.InsertCommand.Connection = this.Connection;
            this._adapter.InsertCommand.CommandText = "INSERT INTO `prnt` (`fd1`, `fd2`, `fd3`, `fd4`) VALUES (?, ?, ?, ?)";
            this._adapter.InsertCommand.CommandType = CommandType.Text;
            this._adapter.InsertCommand.Parameters.Add(new OleDbParameter("fd1", OleDbType.VarWChar, 0, ParameterDirection.Input, 0, 0, "fd1", DataRowVersion.Current, false, null));
            this._adapter.InsertCommand.Parameters.Add(new OleDbParameter("fd2", OleDbType.VarWChar, 0, ParameterDirection.Input, 0, 0, "fd2", DataRowVersion.Current, false, null));
            this._adapter.InsertCommand.Parameters.Add(new OleDbParameter("fd3", OleDbType.VarWChar, 0, ParameterDirection.Input, 0, 0, "fd3", DataRowVersion.Current, false, null));
            this._adapter.InsertCommand.Parameters.Add(new OleDbParameter("fd4", OleDbType.VarWChar, 0, ParameterDirection.Input, 0, 0, "fd4", DataRowVersion.Current, false, null));
        }

        [DebuggerNonUserCode]
        private void InitCommandCollection()
        {
            this._commandCollection = new OleDbCommand[] { new OleDbCommand() };
            this._commandCollection[0].Connection = this.Connection;
            this._commandCollection[0].CommandText = "SELECT fd1, fd2, fd3, fd4 FROM prnt";
            this._commandCollection[0].CommandType = CommandType.Text;
        }

        [DebuggerNonUserCode]
        private void InitConnection()
        {
            this._connection = new OleDbConnection();
            this._connection.ConnectionString = Settings.Default.mydbcnn;
        }

        [HelpKeyword("vs.data.TableAdapter"), DataObjectMethod(DataObjectMethodType.Insert, true), DebuggerNonUserCode]
        public virtual int Insert(string fd1, string fd2, string fd3, string fd4)
        {
            int num2;
            if (fd1 == null)
            {
                this.Adapter.InsertCommand.Parameters[0].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[0].Value = fd1;
            }
            if (fd2 == null)
            {
                this.Adapter.InsertCommand.Parameters[1].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[1].Value = fd2;
            }
            if (fd3 == null)
            {
                this.Adapter.InsertCommand.Parameters[2].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[2].Value = fd3;
            }
            if (fd4 == null)
            {
                this.Adapter.InsertCommand.Parameters[3].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[3].Value = fd4;
            }
            ConnectionState state = this.Adapter.InsertCommand.Connection.State;
            if ((this.Adapter.InsertCommand.Connection.State & ConnectionState.Open) != ConnectionState.Open)
            {
                this.Adapter.InsertCommand.Connection.Open();
            }
            try
            {
                num2 = this.Adapter.InsertCommand.ExecuteNonQuery();
            }
            finally
            {
                if (state == ConnectionState.Closed)
                {
                    this.Adapter.InsertCommand.Connection.Close();
                }
            }
            return num2;
        }

        [HelpKeyword("vs.data.TableAdapter"), DebuggerNonUserCode]
        public virtual int Update(mydbDataSet dataSet)
        {
            return this.Adapter.Update(dataSet, "prnt");
        }

        [DebuggerNonUserCode, HelpKeyword("vs.data.TableAdapter")]
        public virtual int Update(mydbDataSet.prntDataTable dataTable)
        {
            return this.Adapter.Update(dataTable);
        }

        [DebuggerNonUserCode, HelpKeyword("vs.data.TableAdapter")]
        public virtual int Update(DataRow[] dataRows)
        {
            return this.Adapter.Update(dataRows);
        }

        [DebuggerNonUserCode, HelpKeyword("vs.data.TableAdapter")]
        public virtual int Update(DataRow dataRow)
        {
            return this.Adapter.Update(new DataRow[] { dataRow });
        }

        [DebuggerNonUserCode]
        private OleDbDataAdapter Adapter
        {
            get
            {
                if (this._adapter == null)
                {
                    this.InitAdapter();
                }
                return this._adapter;
            }
        }

        [DebuggerNonUserCode]
        public bool ClearBeforeFill
        {
            get
            {
                return this._clearBeforeFill;
            }
            set
            {
                this._clearBeforeFill = value;
            }
        }

        [DebuggerNonUserCode]
        protected OleDbCommand[] CommandCollection
        {
            get
            {
                if (this._commandCollection == null)
                {
                    this.InitCommandCollection();
                }
                return this._commandCollection;
            }
        }

        [DebuggerNonUserCode]
        internal OleDbConnection 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++)
                {
                    if (this.CommandCollection[i] != null)
                    {
                        this.CommandCollection[i].Connection = value;
                    }
                }
            }
        }
    }
}

⌨️ 快捷键说明

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