public static void AddData(ElevatorRowData data) { if (!Disabled) { try { OleDbConnection dataConn = new OleDbConnection(source); OleDbCommand dbComm = dataConn.CreateCommand(); dataConn.Open(); dbComm.CommandText = string.Format(@"INSERT INTO ElevatorLog([Event], [Floor], [DateTime]) VALUES ('{0}', '{1}', '{2}')", data.ElevatorEvent, data.Floor, data.DateTime); dbComm.ExecuteNonQuery(); dataConn.Close(); } catch (Exception e) { MessageBox.Show("Unable to access database. Database logging has been disabled. Error Message: " + e.Message); Disabled = true; } } }
public void DataTableUpdate(ElevatorRowData data) { if (gd.Visible) gd.GridDisplayUpdate(data); }