Example #1
0
        /// <summary>
        /// 查询课程ID+课程名
        /// </summary>
        /// <returns></returns>
        public List <T_CourseName> ExecuteListCourseName()
        {
            string              t_sql  = "select CourseID,CourseName from T_Course";
            SqlHelper           helper = new SqlHelper();
            List <T_CourseName> res    = null;

            using (SqlDataReader reader = helper.ExecuteReader(t_sql, CommandType.Text))
            {
                if (reader.HasRows)
                {
                    res = new List <T_CourseName>();
                    while (reader.Read())
                    {
                        T_CourseName cs = new T_CourseName();
                        cs.CourseID   = reader.GetInt32(0);
                        cs.CourseName = reader.GetString(1);
                        res.Add(cs);
                    }
                }
            }
            return(res);
        }
Example #2
0
        /// <summary>
        /// 存储过程:SelectCourseName(模糊查询课程ID+课程名)
        /// </summary>
        /// <param name="curIndex"></param>
        /// <param name="dataLength"></param>
        /// <param name="courseName"></param>
        /// <returns></returns>
        public List <T_CourseName> ExecuteListCourseName(int curIndex, int dataLength, string courseName = "")
        {
            string t_sql = "SelectCourseName";

            SqlParameter[] pars = new SqlParameter[] {
                new SqlParameter("@curIndex", SqlDbType.Int)
                {
                    Value = curIndex
                },
                new SqlParameter("@dataLength", SqlDbType.Int)
                {
                    Value = dataLength
                },
                new SqlParameter("@courseName", SqlDbType.VarChar)
                {
                    Value = "%" + courseName + "%"
                },
            };
            SqlHelper           helper = new SqlHelper();
            List <T_CourseName> res    = null;

            using (SqlDataReader reader = helper.ExecuteReader(t_sql, CommandType.StoredProcedure, pars)) {
                if (reader.HasRows)
                {
                    res = new List <T_CourseName>();
                    while (reader.Read())
                    {
                        T_CourseName cs = new T_CourseName();
                        cs.CourseID   = reader.GetInt32(0);
                        cs.CourseName = reader.GetString(1);
                        res.Add(cs);
                    }
                }
            }
            return(res);
        }
Example #3
0
 public FrmUpdaateCourse(T_CourseName course) : this()
 {
     this.course = course;
 }