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

📄 dataset1.cs

📁 学生管理系统
💻 CS
📖 第 1 页 / 共 2 页
字号:
            
            public event studentRowChangeEventHandler studentRowDeleting;
            
            public void AddstudentRow(studentRow row) {
                this.Rows.Add(row);
            }
            
            public studentRow AddstudentRow(string name, string sex, int grade, short score, string desp) {
                studentRow rowstudentRow = ((studentRow)(this.NewRow()));
                rowstudentRow.ItemArray = new object[] {
                        name,
                        sex,
                        grade,
                        score,
                        desp,
                        null};
                this.Rows.Add(rowstudentRow);
                return rowstudentRow;
            }
            
            public studentRow FindByid(int id) {
                return ((studentRow)(this.Rows.Find(new object[] {
                            id})));
            }
            
            public System.Collections.IEnumerator GetEnumerator() {
                return this.Rows.GetEnumerator();
            }
            
            public override DataTable Clone() {
                studentDataTable cln = ((studentDataTable)(base.Clone()));
                cln.InitVars();
                return cln;
            }
            
            protected override DataTable CreateInstance() {
                return new studentDataTable();
            }
            
            internal void InitVars() {
                this.columnname = this.Columns["name"];
                this.columnsex = this.Columns["sex"];
                this.columngrade = this.Columns["grade"];
                this.columnscore = this.Columns["score"];
                this.columndesp = this.Columns["desp"];
                this.columnid = this.Columns["id"];
            }
            
            private void InitClass() {
                this.columnname = new DataColumn("name", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnname);
                this.columnsex = new DataColumn("sex", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnsex);
                this.columngrade = new DataColumn("grade", typeof(int), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columngrade);
                this.columnscore = new DataColumn("score", typeof(short), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnscore);
                this.columndesp = new DataColumn("desp", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columndesp);
                this.columnid = new DataColumn("id", typeof(int), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnid);
                this.Constraints.Add(new UniqueConstraint("Dataset1Key1", new DataColumn[] {
                                this.columnid}, true));
                this.columnname.AllowDBNull = false;
                this.columnsex.AllowDBNull = false;
                this.columngrade.AllowDBNull = false;
                this.columnscore.AllowDBNull = false;
                this.columnid.AutoIncrement = true;
                this.columnid.AllowDBNull = false;
                this.columnid.ReadOnly = true;
                this.columnid.Unique = true;
            }
            
            public studentRow NewstudentRow() {
                return ((studentRow)(this.NewRow()));
            }
            
            protected override DataRow NewRowFromBuilder(DataRowBuilder builder) {
                return new studentRow(builder);
            }
            
            protected override System.Type GetRowType() {
                return typeof(studentRow);
            }
            
            protected override void OnRowChanged(DataRowChangeEventArgs e) {
                base.OnRowChanged(e);
                if ((this.studentRowChanged != null)) {
                    this.studentRowChanged(this, new studentRowChangeEvent(((studentRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowChanging(DataRowChangeEventArgs e) {
                base.OnRowChanging(e);
                if ((this.studentRowChanging != null)) {
                    this.studentRowChanging(this, new studentRowChangeEvent(((studentRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleted(DataRowChangeEventArgs e) {
                base.OnRowDeleted(e);
                if ((this.studentRowDeleted != null)) {
                    this.studentRowDeleted(this, new studentRowChangeEvent(((studentRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleting(DataRowChangeEventArgs e) {
                base.OnRowDeleting(e);
                if ((this.studentRowDeleting != null)) {
                    this.studentRowDeleting(this, new studentRowChangeEvent(((studentRow)(e.Row)), e.Action));
                }
            }
            
            public void RemovestudentRow(studentRow row) {
                this.Rows.Remove(row);
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class studentRow : DataRow {
            
            private studentDataTable tablestudent;
            
            internal studentRow(DataRowBuilder rb) : 
                    base(rb) {
                this.tablestudent = ((studentDataTable)(this.Table));
            }
            
            public string name {
                get {
                    return ((string)(this[this.tablestudent.nameColumn]));
                }
                set {
                    this[this.tablestudent.nameColumn] = value;
                }
            }
            
            public string sex {
                get {
                    return ((string)(this[this.tablestudent.sexColumn]));
                }
                set {
                    this[this.tablestudent.sexColumn] = value;
                }
            }
            
            public int grade {
                get {
                    return ((int)(this[this.tablestudent.gradeColumn]));
                }
                set {
                    this[this.tablestudent.gradeColumn] = value;
                }
            }
            
            public short score {
                get {
                    return ((short)(this[this.tablestudent.scoreColumn]));
                }
                set {
                    this[this.tablestudent.scoreColumn] = value;
                }
            }
            
            public string desp {
                get {
                    try {
                        return ((string)(this[this.tablestudent.despColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("无法获取值,因为它是 DBNull。", e);
                    }
                }
                set {
                    this[this.tablestudent.despColumn] = value;
                }
            }
            
            public int id {
                get {
                    return ((int)(this[this.tablestudent.idColumn]));
                }
                set {
                    this[this.tablestudent.idColumn] = value;
                }
            }
            
            public bool IsdespNull() {
                return this.IsNull(this.tablestudent.despColumn);
            }
            
            public void SetdespNull() {
                this[this.tablestudent.despColumn] = System.Convert.DBNull;
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class studentRowChangeEvent : EventArgs {
            
            private studentRow eventRow;
            
            private DataRowAction eventAction;
            
            public studentRowChangeEvent(studentRow row, DataRowAction action) {
                this.eventRow = row;
                this.eventAction = action;
            }
            
            public studentRow Row {
                get {
                    return this.eventRow;
                }
            }
            
            public DataRowAction Action {
                get {
                    return this.eventAction;
                }
            }
        }
    }
}

⌨️ 快捷键说明

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