sc 11 months ago
parent
commit
daeb6e77d7
  1. 14
      View/MachinesSet.xaml.cs

14
View/MachinesSet.xaml.cs

@ -2,6 +2,7 @@
using SunlightCentralizedControlManagement_SCCM_.UserClass;
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Linq;
@ -65,7 +66,20 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
{
if (!string.IsNullOrEmpty(comboBoxMachine.Text))
{
DataRow dr = MainWindowViewModel.Machines.NewRow();//添加数据
dr["Name"] = comboBoxMachine.Text;
dr["Group"] = TextMachineGroup;
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
SQLiteHelpers.Open(); //打开数据库
// SQLiteHelpers.InsertData("Machines", SQLiteHelpers.DataTableToDictionary(dr));
// MainWindowViewModel.Machines = SQLiteHelpers.ExecuteDataSet("select * from Machines Order by id", null).Tables[0]; //读取表写入缓存
SQLiteHelpers.Close();
Griddata.ItemsSource = MainWindowViewModel.Machines.DefaultView;
comboBoxMachine.Text = null;
}
else
{

Loading…
Cancel
Save