public static bool CreateSQlConnection() { try { dbContext = new WeedonDataContext(); dbContext.CommandTimeout = 100; if (windowsAuthentication) { dbContext = new WeedonDataContext("Data Source=" + serverName + ";Initial Catalog=Weedon;Integrated Security=True"); } else { dbContext = new WeedonDataContext("Data Source=" + serverName + ";Initial Catalog=Weedon;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 WeedonDataContext(); dbContext.CommandTimeout = 100; }