public static TB_DULIEUKHACHHANG finByDanhBo(string danhbo) { try { KhachHangDataContext db = new KhachHangDataContext(); var query = from q in db.TB_DULIEUKHACHHANGs where q.DANHBO == danhbo select q; return(query.SingleOrDefault()); } catch (Exception ex) { } return(null); }
public static TB_DULIEUKHACHHANG_HUYDB finByDanhBoHuy(string danhbo) { try { KhachHangDataContext db = new KhachHangDataContext(); var query = (from q in db.TB_DULIEUKHACHHANG_HUYDBs where q.DANHBO == danhbo orderby q.CREATEDATE descending select q).Take(1); return(query.SingleOrDefault()); } catch (Exception ex) { } return(null); }
public static DataTable getDataTable(string sql) { DataTable table = new DataTable(); KhachHangDataContext db = new KhachHangDataContext(); try { db.Connection.Open(); SqlDataAdapter adapter = new SqlDataAdapter(sql, db.Connection.ConnectionString); adapter.Fill(table); } catch (Exception ex) { } finally { db.Connection.Close(); } return(table); }