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

📄 dataset1.cs

📁 C#经典范例50讲
💻 CS
📖 第 1 页 / 共 2 页
字号:
            }
            
            public userRow AdduserRow(string username, string address, string Email) {
                userRow rowuserRow = ((userRow)(this.NewRow()));
                rowuserRow.ItemArray = new object[] {
                        username,
                        address,
                        Email,
                        null};
                this.Rows.Add(rowuserRow);
                return rowuserRow;
            }
            
            public userRow FindBy编号(int 编号) {
                return ((userRow)(this.Rows.Find(new object[] {
                            编号})));
            }
            
            public System.Collections.IEnumerator GetEnumerator() {
                return this.Rows.GetEnumerator();
            }
            
            public override DataTable Clone() {
                userDataTable cln = ((userDataTable)(base.Clone()));
                cln.InitVars();
                return cln;
            }
            
            protected override DataTable CreateInstance() {
                return new userDataTable();
            }
            
            internal void InitVars() {
                this.columnusername = this.Columns["username"];
                this.columnaddress = this.Columns["address"];
                this.columnEmail = this.Columns["Email"];
                this.column编号 = this.Columns["编号"];
            }
            
            private void InitClass() {
                this.columnusername = new DataColumn("username", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnusername);
                this.columnaddress = new DataColumn("address", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnaddress);
                this.columnEmail = new DataColumn("Email", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnEmail);
                this.column编号 = new DataColumn("编号", typeof(int), null, System.Data.MappingType.Element);
                this.Columns.Add(this.column编号);
                this.Constraints.Add(new UniqueConstraint("Constraint1", new DataColumn[] {
                                this.column编号}, true));
                this.column编号.AutoIncrement = true;
                this.column编号.AllowDBNull = false;
                this.column编号.Unique = true;
            }
            
            public userRow NewuserRow() {
                return ((userRow)(this.NewRow()));
            }
            
            protected override DataRow NewRowFromBuilder(DataRowBuilder builder) {
                return new userRow(builder);
            }
            
            protected override System.Type GetRowType() {
                return typeof(userRow);
            }
            
            protected override void OnRowChanged(DataRowChangeEventArgs e) {
                base.OnRowChanged(e);
                if ((this.userRowChanged != null)) {
                    this.userRowChanged(this, new userRowChangeEvent(((userRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowChanging(DataRowChangeEventArgs e) {
                base.OnRowChanging(e);
                if ((this.userRowChanging != null)) {
                    this.userRowChanging(this, new userRowChangeEvent(((userRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleted(DataRowChangeEventArgs e) {
                base.OnRowDeleted(e);
                if ((this.userRowDeleted != null)) {
                    this.userRowDeleted(this, new userRowChangeEvent(((userRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleting(DataRowChangeEventArgs e) {
                base.OnRowDeleting(e);
                if ((this.userRowDeleting != null)) {
                    this.userRowDeleting(this, new userRowChangeEvent(((userRow)(e.Row)), e.Action));
                }
            }
            
            public void RemoveuserRow(userRow row) {
                this.Rows.Remove(row);
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class userRow : DataRow {
            
            private userDataTable tableuser;
            
            internal userRow(DataRowBuilder rb) : 
                    base(rb) {
                this.tableuser = ((userDataTable)(this.Table));
            }
            
            public string username {
                get {
                    try {
                        return ((string)(this[this.tableuser.usernameColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("无法获取值,因为它是 DBNull。", e);
                    }
                }
                set {
                    this[this.tableuser.usernameColumn] = value;
                }
            }
            
            public string address {
                get {
                    try {
                        return ((string)(this[this.tableuser.addressColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("无法获取值,因为它是 DBNull。", e);
                    }
                }
                set {
                    this[this.tableuser.addressColumn] = value;
                }
            }
            
            public string Email {
                get {
                    try {
                        return ((string)(this[this.tableuser.EmailColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("无法获取值,因为它是 DBNull。", e);
                    }
                }
                set {
                    this[this.tableuser.EmailColumn] = value;
                }
            }
            
            public int 编号 {
                get {
                    return ((int)(this[this.tableuser.编号Column]));
                }
                set {
                    this[this.tableuser.编号Column] = value;
                }
            }
            
            public bool IsusernameNull() {
                return this.IsNull(this.tableuser.usernameColumn);
            }
            
            public void SetusernameNull() {
                this[this.tableuser.usernameColumn] = System.Convert.DBNull;
            }
            
            public bool IsaddressNull() {
                return this.IsNull(this.tableuser.addressColumn);
            }
            
            public void SetaddressNull() {
                this[this.tableuser.addressColumn] = System.Convert.DBNull;
            }
            
            public bool IsEmailNull() {
                return this.IsNull(this.tableuser.EmailColumn);
            }
            
            public void SetEmailNull() {
                this[this.tableuser.EmailColumn] = System.Convert.DBNull;
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class userRowChangeEvent : EventArgs {
            
            private userRow eventRow;
            
            private DataRowAction eventAction;
            
            public userRowChangeEvent(userRow row, DataRowAction action) {
                this.eventRow = row;
                this.eventAction = action;
            }
            
            public userRow Row {
                get {
                    return this.eventRow;
                }
            }
            
            public DataRowAction Action {
                get {
                    return this.eventAction;
                }
            }
        }
    }
}

⌨️ 快捷键说明

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