一个表就是一个实体,在实体中包涵表的字段,如果你是用的弱类型来开发的就一个字段就包含表的一行记录,就向javabean一样可以写访问语句

解决方案 »

  1.   

    using System;
    using System.Collections;namespace Model
    {
        #region Stu    /// <summary>
        ///Stu Info object for mapped table 'stu'.
        /// </summary>
        public class stuInfo
        {
            #region Member Variables        private string _stuID;
            private string _stuName;
            private string _stuPwd;
            private int _stuGender;
            private string _stuMail;
            private int _stuStatus;        #endregion        #region Constructors        public stuInfo() { }        public stuInfo(string stuId,string stuName, string stuPwd, int stuGender, string stuMail, int stuStatus)
            {
                this._stuID = stuId;
                this._stuName = stuName;
                this._stuPwd = stuPwd;
                this._stuGender = stuGender;
                this._stuMail = stuMail;
                this._stuStatus = stuStatus;
            }        #endregion        #region Public Properties        public string StuID
            {
                get { return _stuID; }
                set
                {
                    if (value != null && value.Length > 20)
                        throw new ArgumentOutOfRangeException("Invalid value for StuID", value, value.ToString());
                    _stuID = value;
                }
            }        public string StuName
            {
                get { return _stuName; }
                set
                {
                    if (value != null && value.Length > 20)
                        throw new ArgumentOutOfRangeException("Invalid value for StuName", value, value.ToString());
                    _stuName = value;
                }
            }        public string StuPwd
            {
                get { return _stuPwd; }
                set
                {
                    if (value != null && value.Length > 20)
                        throw new ArgumentOutOfRangeException("Invalid value for StuPwd", value, value.ToString());
                    _stuPwd = value;
                }
            }        public int StuGender
            {
                get { return _stuGender; }
                set { _stuGender = value; }
            }        public string StuMail
            {
                get { return _stuMail; }
                set
                {
                    if (value != null && value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for StuMail", value, value.ToString());
                    _stuMail = value;
                }
            }        public int StuStatus
            {
                get { return _stuStatus; }
                set { _stuStatus = value; }
            }        #endregion
        }
        #endregion}