This commit is contained in:
sc committed 2024-11-23 22:39:23 +08:00
commit daeb6e77d7
1 file changed
+14
+14
View File
@@ -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
{