コード例 #1
0
ファイル: Log.cs プロジェクト: JayHagerty/Elevator
        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;
                }
            }
        }
コード例 #2
0
 public void DataTableUpdate(ElevatorRowData data)
 {
     if (gd.Visible)
         gd.GridDisplayUpdate(data);
 }