private void Connection_StateChange(object sender, System.Data.StateChangeEventArgs e) { if (e.CurrentState == System.Data.ConnectionState.Open) { TriggerEvent("fivelife.database.connected"); } }
private void StateChange(object sender, System.Data.StateChangeEventArgs e) { if (!(e.CurrentState == System.Data.ConnectionState.Closed || e.CurrentState == System.Data.ConnectionState.Broken)) { HasConnected = true; } }
private void MySqlConnection_StateChange(object sender, System.Data.StateChangeEventArgs e) { if (mySqlConnection.State == System.Data.ConnectionState.Broken || mySqlConnection.State == System.Data.ConnectionState.Closed) { Open(); } }
/// <summary> /// Event that notifies the current state of a change. /// </summary> /// <param name="sender">The object where the event was raised.</param> /// <param name="e">Additional event information.</param> void result_StateChange(object sender, System.Data.StateChangeEventArgs e) { if (e.CurrentState == System.Data.ConnectionState.Closed) { connections.Remove((DbConnection)sender); } }
// private void conn_StateChange(object sender, System.Data.StateChangeEventArgs e) { var context = GlobalHost.ConnectionManager.GetHubContext <TicketsHub>(); // Broadcast if connection state changed ( client function showMessage (see init.js) context.Clients.All.showMessage("Current State: " + e.CurrentState.ToString() + " Original State: " + e.OriginalState.ToString(), "connection state changed"); }
private void Con_StateChange(object sender, System.Data.StateChangeEventArgs e) { if (e.CurrentState == System.Data.ConnectionState.Open) { (sender as SQLiteConnection).EnableExtensions(true); (sender as SQLiteConnection).LoadExtension("idpsqlextensions"); } }
private void _connection_StateChange(object sender, System.Data.StateChangeEventArgs e) { Logger.Info($"{_connection.Database}: {e.OriginalState} -> {e.CurrentState}."); //if (e.OriginalState == System.Data.ConnectionState.Open && // e.CurrentState != System.Data.ConnectionState.Broken) // this.Reconnect(); }
private void connection_StateChange(object sender, System.Data.StateChangeEventArgs e) { statusBar.Panels[0].Text = connection.State.ToString(); bool closed = (connection.State == System.Data.ConnectionState.Closed); this.btConnect.Enabled = closed; this.btDisconnect.Enabled = !closed; }
static void conn_StateChange(object sender, System.Data.StateChangeEventArgs e) { // Takes place when the connection state changes if (e.CurrentState == System.Data.ConnectionState.Closed) { //if (((SqlConnection)sender).StatisticsEnabled) // LastStatistics = new ConnectionStatistics(((SqlConnection)sender).RetrieveStatistics()); } }
void connection_StateChange(object sender, System.Data.StateChangeEventArgs e) { if (!isClosing && connection.State != System.Data.ConnectionState.Open && connection.State != System.Data.ConnectionState.Connecting) { string connectionString; connectionString = "SERVER=" + server + ";" + "DATABASE=" + database + ";" + "UID=" + uid + ";" + "PASSWORD="******";"; connection = new MySqlConnection(connectionString); OpenConnection(); } }
public static void LogConnectionStateChange(object sender, System.Data.StateChangeEventArgs e) { StringBuilder sb = new StringBuilder(); sb.Append("Connection State Change Event: "); sb.Append(Environment.NewLine); sb.Append(" Original State: " + e.OriginalState); sb.Append(" Current State: " + e.CurrentState); LogMessage(sb.ToString()); }
private void SqlConn_StateChange(object sender, System.Data.StateChangeEventArgs e) { var sqlConnInstance = sender as SqlConnection; if (sqlConnInstance != null) { Console.WriteLine(sqlConnInstance.State); Console.WriteLine(sqlConnInstance.DataSource); Console.WriteLine(sqlConnInstance.Database); } }
private void Connection_StateChange(object sender, System.Data.StateChangeEventArgs ev) { if (ev.CurrentState == System.Data.ConnectionState.Open) { DynValue onConnect = db.Get("onConnect"); if (onConnect != null) { onConnect.Function.Call(db); } } }
private void ActiveConnection_StateChange(object sender, System.Data.StateChangeEventArgs e) { if (ActiveConnection.State == System.Data.ConnectionState.Open) { this.IsConnectionActive = true; } else { this.IsConnectionActive = false; } }
static void StoreModel_Connection_StateChange(object sender, System.Data.StateChangeEventArgs e) { if (e.CurrentState == System.Data.ConnectionState.Broken) { _storeModel.Database.Connection.Close(); } if (e.CurrentState == System.Data.ConnectionState.Closed) { _storeModel.Database.Connection.Open(); } }
static void mConnection_StateChange(object sender, System.Data.StateChangeEventArgs e) { if (e.CurrentState == System.Data.ConnectionState.Open) { Logger.WriteLine("Connected to MySQL server! Changing timestamp to UTC"); using (MySqlCommand cmd = new MySqlCommand("SET time_zone = '+00:00';", _connection)) { cmd.ExecuteNonQuery(); } } }
void Connection_StateChange(object sender, System.Data.StateChangeEventArgs e) { if (e.CurrentState == System.Data.ConnectionState.Closed && !mShuttingDown) { Console.WriteLine("MySQL Connection closed. Reconnecting!"); Connection.StateChange -= Connection_StateChange; Connect(); } else if (e.CurrentState == System.Data.ConnectionState.Open) { Console.WriteLine("MySQL Connection opened!"); } }
/// <summary> /// Remove SqlConnection Instance. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> static void ConnStateChange(object sender, System.Data.StateChangeEventArgs e) { SqlConnection obj = (SqlConnection)sender; if (e.CurrentState == System.Data.ConnectionState.Closed || e.CurrentState == System.Data.ConnectionState.Broken) { lock (_conns) { _conns.Remove(obj); Console.WriteLine("** Connection Closed ** " + ConnectionCount + " " + ++_closeCount); } } }
/// <summary> /// Event that notifies the current state of a change. /// </summary> /// <param name="sender">The object where the event was raised.</param> /// <param name="e">Additional event information.</param> void result_StateChange(object sender, System.Data.StateChangeEventArgs e) { if (e.CurrentState == System.Data.ConnectionState.Closed) { foreach (DAODatabaseHelper db in connections) { if (db.Connection == sender) { connections.Remove(db); break; } } } }
/// <summary> /// Event that notifies the current state of a change. /// </summary> /// <param name="sender">The object where the event was raised.</param> /// <param name="e">Additional event information.</param> void result_StateChange(object sender, System.Data.StateChangeEventArgs e) { if (e.CurrentState == System.Data.ConnectionState.Closed) { foreach (T connectionContainer in _connections) { if (connectionContainer.Connection == sender) { _connections.Remove(connectionContainer); break; } } } }
static void Connection_StateChange(object sender, System.Data.StateChangeEventArgs e) { SqlConnection connection = sender as SqlConnection; Console.WriteLine(); Console.WriteLine //вывод информации о соединении и его состоянии ( "Connection to" + Environment.NewLine + "Data Source: " + connection.DataSource + Environment.NewLine + "Database: " + connection.Database + Environment.NewLine + "State: " + connection.State ); }
static void connection_StateChange(object sender, System.Data.StateChangeEventArgs e) { SqlConnection connection = sender as SqlConnection; Console.WriteLine(); Console.WriteLine ( "Connection to" + Environment.NewLine + "Data Source: " + connection.DataSource + Environment.NewLine + "Database: " + connection.Database + Environment.NewLine + "State: " + connection.State ); }
void Connection_StateChange(object sender, System.Data.StateChangeEventArgs e) { if (e.CurrentState == System.Data.ConnectionState.Closed && !mShuttingDown) { Logger.WriteLog(Logger.LogTypes.Info, "MySQL Connection lost, reconnecting..."); Connection.StateChange -= Connection_StateChange; Connect(); } else if (e.CurrentState == System.Data.ConnectionState.Open) { //empty lines pzl Console.WriteLine(); } }
void Connection_StateChange(object sender, System.Data.StateChangeEventArgs e) { // Set ANSI_NULLS OFF when any connection is opened. This is needed because of a bug in Entity Framework // that is not fixed in EF 5 when using DbContext. if (e.CurrentState == System.Data.ConnectionState.Open) { var connection = (System.Data.Common.DbConnection)sender; using (var cmd = connection.CreateCommand()) { cmd.CommandText = "SET ANSI_NULLS OFF"; cmd.ExecuteNonQuery(); } } }
private static void MSSQL_Connection_StateChange(object sender, System.Data.StateChangeEventArgs e) { if (e.CurrentState == System.Data.ConnectionState.Closed) { reconnect: if (!MSSQL_Connection.TryOpen()) { switch (MessageBox.Show("Не удалось переподключиться к БД!", "Ошибка!", MessageBoxButton.YesNo)) { case MessageBoxResult.Yes: goto reconnect; } } } }
private static void Connection_StateChange(object sender, System.Data.StateChangeEventArgs e) { switch (e.CurrentState) { case System.Data.ConnectionState.Open: ConnectionState = ConnectionStateEnum.CONNECTED; break; case System.Data.ConnectionState.Closed: ConnectionState = ConnectionStateEnum.DISCONNECTED; break; case System.Data.ConnectionState.Broken: ConnectionState = ConnectionStateEnum.BROKEN; break; default: break; } }
private void Dbconnect_StateChange(object sender, System.Data.StateChangeEventArgs e) { if (e.CurrentState == System.Data.ConnectionState.Open) { panel5.BackColor = Color.LimeGreen; label1.ForeColor = Color.LimeGreen; label1.Text = "Connected"; } if (e.CurrentState == System.Data.ConnectionState.Connecting) { panel5.BackColor = Color.Yellow; label1.ForeColor = Color.Yellow; label1.Text = "Connecting..."; } if (e.CurrentState == System.Data.ConnectionState.Closed) { panel5.BackColor = Color.Red; label1.ForeColor = Color.Red; label1.Text = "Not Connected"; } if (e.CurrentState == System.Data.ConnectionState.Broken) { panel5.BackColor = Color.DarkRed; label1.ForeColor = Color.DarkRed; label1.Text = "Error"; } if (e.CurrentState == System.Data.ConnectionState.Executing) { panel5.BackColor = Color.Yellow; label1.ForeColor = Color.Yellow; label1.Text = "Running Command"; } if (e.CurrentState == System.Data.ConnectionState.Fetching) { panel5.BackColor = Color.Yellow; label1.ForeColor = Color.Yellow; label1.Text = "Fetching..."; } }
void connection_StateChange(object sender, System.Data.StateChangeEventArgs e) { if (e.CurrentState == System.Data.ConnectionState.Closed) { if (Stop) { return; } ////Console.WriteLine("MySQL connection closed. Reconnecting!"); _logFile.WriteLine("Lost connection (connection Closed). Reconnecting."); _connection.StateChange -= connection_StateChange; Connect(); } else if (e.CurrentState == System.Data.ConnectionState.Open) { _logFile.WriteLine("Connected to server!"); ////Console.WriteLine("MySQL connection opened!"); } else { _logFile.WriteLine("State change: " + e.CurrentState); } }
void MySqlConnection_StateChange(object sender, System.Data.StateChangeEventArgs e) { ConnectionState new_state = ConnectionState.Disconnected; if (mDatabaseDisabled) { new_state = ConnectionState.Disabled; } else { switch (e.CurrentState) { case System.Data.ConnectionState.Broken: case System.Data.ConnectionState.Closed: new_state = ConnectionState.Disconnected; break; case System.Data.ConnectionState.Connecting: new_state = ConnectionState.Connecting; break; default: new_state = ConnectionState.Connected; break; } } if (new_state != mConnectionState) { Utility.Log.LogFormat("Database connection state changed. Old = {0}, new = {1}", mConnectionState, new_state); mConnectionState = new_state; if (OnConnectionStateChanged != null) { OnConnectionStateChanged(new_state); } } }
//连接的状态改变事件 static void con_StateChange(object sender, System.Data.StateChangeEventArgs e) { Console.WriteLine(e.CurrentState.ToString()); }