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)); }
public static DataTable GetBookInfoByID(string bookID) { string sql = "select * from Book where BookID = '" + bookID + "'"; return(DBAccess.ExecuteQueryReturnDT(sql)); }
//获得表中的数据 public static DataTable GetDataByTableName(string tablename) { string sql = "select * from " + tablename; return(DBAccess.ExecuteQueryReturnDT(sql)); }
//获得某一个表的所有列信息 public static DataTable GetColumnsInfo(string tablename) { string sql = "select * from INFORMATION_SCHEMA.COLUMNS t where t.TABLE_NAME = '" + tablename + "'"; return(DBAccess.ExecuteQueryReturnDT(sql)); }
//获得数据库中的所有表信息 public static DataTable GetTableInfo() { string sql = "select * from INFORMATION_SCHEMA.TABLES"; return(DBAccess.ExecuteQueryReturnDT(sql)); }
//根据id获得学生信息 public static DataTable GetStuInfoByID(string stuid) { string sql = "select * from Student where StuID = '" + stuid + "'"; return(DBAccess.ExecuteQueryReturnDT(sql)); }