private void UpdateButton_Click(object sender, RoutedEventArgs e) { DataAccesBDData.AddDataTablRun(new ViewTaiblBDData.ClassTablRun() { НомерRun = "18.12.2019 14:18:14:597", ВремяЗапуска = "18.12.2019 14:18:52:818", ЗначениеТаймер = "18 14:18:30:0", ОбщийПорог = 1, Порог = 10, Синхронизация = 0, Триггер = 2 }); // DataAccesBDData.updateTimeZapuskDataTablRun("18.12.2019 14:18:52:818", "18.12.2019 14:18:14:597"); // DataAccesBDData.updateTimeStopDataTablRun("18.12.2019 14:18:52:818", "18.12.2019 14:18:14:597"); RanGrid.ItemsSource = DataAccesBDData.GetDataRun(); // DataAccesBDData.AddDataTablФайлы("1_19.12.2019 00.10.23_N", "У6", "19.12.2019 00.10.23", "18.12.2019 14:18:14:597"); // DataAccesBDData.updateTimeStopDataTablФайл("19.12.2019 00.10.23", "18.12.2019 14:18:14:597"); int[] amp = new int[12]; double[] sig = new double[12]; DataAccesBDData.AddDataTablSob("1_19.12.2019 00.10.23_N", "Y4", "18.12.2019 14:18:14:597", amp, "1", amp, amp, sig, 1); DataAccesBDData.AddDataTablSobNeutron("1_19.12.2019 00.10.23_N", 1, 10, 5, 9, "18.12.2019 14:18:14:597", 7, 4, 8, 1); }
private void BDReadNeutron(string nameFile, int D, int Amp, int TimeFirst, int TimeEnd, string time, int TimeAmp, int TimeFirst3, int TimeEnd3, bool test, bool bad) { if (FlagSaveBD) { if (wayDataBD.Split('.')[1] == "db" || wayDataBD.Split('.')[1] == "db3") { if (!test) { DataAccesBDData.Path = wayDataBD; int x = 0; if (bad) { x = 1; } DataAccesBDData.AddDataTablSobNeutron(nameFile, D, Amp, TimeFirst, TimeEnd, time, TimeAmp, TimeFirst3, TimeEnd3, x); } } else { string connectionString; if (test) { connectionString = @"Provider = Microsoft.ACE.OLEDB.12.0; Data Source =" + wayDataTestBD; } else { connectionString = @"Provider = Microsoft.ACE.OLEDB.12.0; Data Source =" + wayDataBD; } // Создание подключения var podg = new OleDbConnection(connectionString); try { // Открываем подключение podg.Open(); // MessageBox.Show("Подключение открыто"); OleDbCommand oleDbCommand = new OleDbCommand { Connection = podg, CommandText = "INSERT INTO[Нейтроны](" + "ИмяФайла, Dn, Amp, TimeFirst, TimeEnd, Время, TimeFirst3, TimeEnd3, TimeAmp, bad) VALUES (" + "'" + nameFile + "'" + "," + "'" + D + "'" + ", " + "'" + Amp + "'" + ", " + "'" + TimeFirst + "'" + ", " + "'" + TimeEnd + "'" + ", " + "'" + time + "'" + ", " + "'" + TimeFirst3 + "'" + ", " + "'" + TimeEnd3 + "'" + ", " + "'" + TimeAmp + "'" + ", " + "'" + bad.ToString() + "'" + ")" // CommandText = "INSERT INTO[RAN](" + "НомерRAN, Синхронизация, ОбщийПорог, Порог,Триггер,ЗначениеТаймера,ВремяЗапуска) VALUES (nameRan, sinx, allPorog, porog, trg, time, timeStart)" }; oleDbCommand.Connection = podg; new OleDbCommand { Connection = podg, CommandText = "INSERT INTO[Нейтроны](" + "ИмяФайла, Dn, Amp, TimeFirst, TimeEnd, Время, TimeFirst3, TimeEnd3, TimeAmp, bad) VALUES (" + "'" + nameFile + "'" + "," + "'" + D + "'" + ", " + "'" + Amp + "'" + ", " + "'" + TimeFirst + "'" + ", " + "'" + TimeEnd + "'" + ", " + "'" + time + "'" + ", " + "'" + TimeFirst3 + "'" + ", " + "'" + TimeEnd3 + "'" + ", " + "'" + TimeAmp + "'" + ", " + "'" + bad.ToString() + "'" + ")" // CommandText = "INSERT INTO[RAN](" + "НомерRAN, Синхронизация, ОбщийПорог, Порог,Триггер,ЗначениеТаймера,ВремяЗапуска) VALUES (nameRan, sinx, allPorog, porog, trg, time, timeStart)" }.ExecuteNonQuery(); new OleDbCommand { Connection = podg, CommandText = "INSERT INTO[Нейтроны](" + "ИмяФайла, Dn, Amp, TimeFirst, TimeEnd, Время, TimeFirst3, TimeEnd3, TimeAmp, bad) VALUES (" + "'" + nameFile + "'" + "," + "'" + D + "'" + ", " + "'" + Amp + "'" + ", " + "'" + TimeFirst + "'" + ", " + "'" + TimeEnd + "'" + ", " + "'" + time + "'" + ", " + "'" + TimeFirst3 + "'" + ", " + "'" + TimeEnd3 + "'" + ", " + "'" + TimeAmp + "'" + ", " + "'" + bad.ToString() + "'" + ")" // CommandText = "INSERT INTO[RAN](" + "НомерRAN, Синхронизация, ОбщийПорог, Порог,Триггер,ЗначениеТаймера,ВремяЗапуска) VALUES (nameRan, sinx, allPorog, porog, trg, time, timeStart)" }.Dispose(); } catch (Exception ex) { } finally { // закрываем подключение podg.Close(); } } } }