public Connect ( string host, string userId, string userPwd, string dbName ) : void | ||
host | string | |
userId | string | |
userPwd | string | |
dbName | string | |
Résultat | void |
public void Connect(string host, string userId, string userPwd, string dbName)
{
if (Connection != null)
return;
QPS = new IntervalCounter("", 1000);
Connection = new SqlConnection(string.Format("server={0};uid={1};pwd={2};database={3};", host, userId, userPwd, dbName));
Connection.Open();
}
public void Initialize(String host, String userId, String userPwd, String dbName) { if (_cancelTasks != null) throw new AegisException(AegisResult.AlreadyInitialized); // Connection Test try { DBConnector dbc = new DBConnector(); dbc.Connect(host, userId, userPwd, dbName); dbc.Close(); } catch (Exception e) { throw new AegisException(AegisResult.MySqlConnectionFailed, e, "Invalid MySQL connection."); } HostAddress = host; UserId = userId; UserPwd = userPwd; DBName = dbName; _cancelTasks = new CancellationTokenSource(); }