public static List <BookInfo> Select(string sort) { cmdText = "select * from BookInfo where BookType=N'" + sort + "'"; DataSet ds = DBHelp.GetDataSet(cmdText); DataTable dt = ds.Tables[0]; List <BookInfo> lstBooks = new List <BookInfo>(); if (dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { BookInfo book = new BookInfo(); book.isbn = Convert.ToInt32(dr["ISBN"]); book.Price = Convert.ToInt32(dr["price"]); book.CountIn = Convert.ToInt32(dr["countIn"]); book.CountOut = Convert.ToInt32(dr["countOut"]); book.BookName = dr["bookName"].ToString(); book.BookAuthor = dr["bookAuthor"].ToString(); book.BookAbout = dr["bookAbout"].ToString(); book.BookType = dr["bookType"].ToString(); book.image = dr["Image"].ToString(); lstBooks.Add(book); } } return(lstBooks); }
public static UsrInfo Select(string usrName) { string cmdText = "select * from UsrInfo where usrName='" + usrName + "'"; DataSet ds = DBHelp.GetDataSet(cmdText); UsrInfo user = null; DataTable dt = ds.Tables[0]; if (dt.Rows.Count > 0) { user = new UsrInfo(); DataRow dr = dt.Rows[0]; user.UsrEmail = dr["usrEmail"].ToString(); user.UsrName = dr["usrName"].ToString(); user.UsrPwd = dr["usrPwd"].ToString(); } return(user); }