diff --git a/View/MachinesSet.xaml b/View/MachinesSet.xaml index 31fe514..ccd40d1 100644 --- a/View/MachinesSet.xaml +++ b/View/MachinesSet.xaml @@ -59,7 +59,7 @@ - + diff --git a/View/MachinesSet.xaml.cs b/View/MachinesSet.xaml.cs index 6102701..fe559e9 100644 --- a/View/MachinesSet.xaml.cs +++ b/View/MachinesSet.xaml.cs @@ -66,15 +66,20 @@ namespace SunlightCentralizedControlManagement_SCCM_.View { if (!string.IsNullOrEmpty(comboBoxMachine.Text)) { - DataRow dr = MainWindowViewModel.Machines.NewRow();//添加数据 + + + + Dictionary dr_new = new Dictionary();//缓存函数 + dr_new.Add("Name", comboBoxMachine.Text); + dr_new.Add("Groups", TextMachineGroup.Text); + - 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.InsertData("Machines", dr_new); + MainWindowViewModel.Machines = SQLiteHelpers.ExecuteDataSet("select * from Machines Order by id", null).Tables[0]; //读取表写入缓存 SQLiteHelpers.Close();