コード例 #1
0
ファイル: DB_Student.cs プロジェクト: qiyiran/StudentsManage
        public static DataTable SearchStuByWord(string keyword)
        {
            string sql = "select * from Student where StuID like '%" + keyword + "%' or StuName like '%" + keyword + "%' or StuClassID like '%" + keyword + "%' or StuClassName like '%"
                         + keyword + "%' or StuClassTeacher like '%" + keyword + "%' or StuSex like '%" + keyword + "%' or StuAge like '%" + keyword + "%' or StuHeight like '%"
                         + keyword + "%' or StuWeight like '%" + keyword + "%' or StuAddress like '%" + keyword + "%'";

            return(DBAccess.ExecuteQueryReturnDT(sql));
        }
コード例 #2
0
        public static DataTable GetBookInfoByID(string bookID)
        {
            string sql = "select * from Book where BookID = '" + bookID + "'";

            return(DBAccess.ExecuteQueryReturnDT(sql));
        }
コード例 #3
0
        //获得表中的数据
        public static DataTable GetDataByTableName(string tablename)
        {
            string sql = "select * from " + tablename;

            return(DBAccess.ExecuteQueryReturnDT(sql));
        }
コード例 #4
0
        //获得某一个表的所有列信息
        public static DataTable GetColumnsInfo(string tablename)
        {
            string sql = "select * from INFORMATION_SCHEMA.COLUMNS t where t.TABLE_NAME = '" + tablename + "'";

            return(DBAccess.ExecuteQueryReturnDT(sql));
        }
コード例 #5
0
        //获得数据库中的所有表信息
        public static DataTable GetTableInfo()
        {
            string sql = "select * from INFORMATION_SCHEMA.TABLES";

            return(DBAccess.ExecuteQueryReturnDT(sql));
        }
コード例 #6
0
ファイル: DB_Student.cs プロジェクト: qiyiran/StudentsManage
        //根据id获得学生信息
        public static DataTable GetStuInfoByID(string stuid)
        {
            string sql = "select * from Student where StuID = '" + stuid + "'";

            return(DBAccess.ExecuteQueryReturnDT(sql));
        }