public static bool CreateSQlConnection() { try { dbContext = new DoanhSoDataContext(); dbContext.CommandTimeout = 100; if (windowsAuthentication) { dbContext = new DoanhSoDataContext("Data Source=" + serverName + ";Initial Catalog=QuanLyDoanhSo;Integrated Security=True"); } else { dbContext = new DoanhSoDataContext("Data Source=" + serverName + ";Initial Catalog=QuanLyDoanhSo;User ID=" + userName + ";Password="******";"); } var sql = from data in dbContext.Users select data; return sql.Count() >= 0; } catch { return false; } }
public SQLConnection() { // set command time out by seconds dbContext = new DoanhSoDataContext(); dbContext.CommandTimeout = 100; }