Пример #1
0
        /// <summary>
        /// 筛选后显示
        /// </summary>
        /// <param name="readeridd"></param>
        private void displaysortorder(String readeridd, string classname, string teachername)
        {
            string sql = "";

            if (classname == "" && teachername != "")
            {
                sql = "select * from  appointment where teacher_name='{0}' and  enable='占用'";
                sql = string.Format(sql, teachername);
            }
            else if (classname != "" && teachername == "")
            {
                sql = "select * from  appointment where class_name='{0}' and  enable='占用'";
                sql = string.Format(sql, classname);
            }
            else if (classname != "" && teachername != "")
            {
                sql = "select * from  appointment where teacher_name='{0}' and class_name='{1}' and  enable='占用'";
                sql = string.Format(sql, teachername, classname);
            }
            else
            {
                MessageBox.Show("不能全为空");
                return;
            }
            //创建数据库操作类的对象
            Function fun = new Function();
            //执行对数据库表的查询操作
            DataSet   ds = fun.Query(sql);
            DataTable dt = ds.Tables[0];

            Dgv_Gm.DataSource = dt;
            Dgv_Gm.Refresh();
        }
Пример #2
0
        public void displaydgv()
        {
            string sql;

            if (GmSelection.order_flag == 1)
            {
                sql = "select * from  appointment where enable='占用' ";
            }
            else if (GmSelection.teacher_flag == 1)
            {
                sql = "select * from  teacher ";
            }
            else
            {
                sql = "select * from  class ";
            }

            //创建数据库操作类的对象
            Function fun = new Function();
            //执行对数据库表的查询操作
            DataSet   ds = fun.Query(sql);
            DataTable dt = ds.Tables[0];

            Dgv_Gm.DataSource = dt;
            Dgv_Gm.Refresh();
        }
Пример #3
0
        private void displaysortclass(string name)
        {
            string sql = "select * from  class where class_name='{0}'";

            sql = string.Format(sql, name);
            //创建数据库操作类的对象
            Function fun = new Function();
            //执行对数据库表的查询操作
            DataSet   ds = fun.Query(sql);
            DataTable dt = ds.Tables[0];

            Dgv_Gm.DataSource = dt;
            Dgv_Gm.Refresh();
        }