public static ObservableCollection<ItemTreeNode> GetTreeData(string dbName) { var list = new ObservableCollection<ItemTreeNode>(); if (File.Exists(dbName)) { using (var deLinker = new DbOperator(dbName, DbCategory.Accdb)) { DataSet ds = deLinker.ExecuteDataSet("select * from Demo"); if (ds.Tables.Count == 0) return list; foreach (DataRow row in ds.Tables[0].Rows) { var data = new ItemTreeNode { Id = Convert.ToInt32(row["Id"]), Name = row["ItemInfo"].ToString(), Pid = Convert.ToInt32(row["Pid"]), ProjInfoIndexList = ExplainListInfo(row["ProjIndexList"].ToString()), }; list.Add(data); } } } return list; }
public static ObservableCollection<ProjInfoData> GetProjInfoDatas(string dbName) { var list = new ObservableCollection<ProjInfoData>(); if (File.Exists(dbName)) { using (var deLinker = new DbOperator(dbName, DbCategory.Accdb)) { DataSet ds = deLinker.ExecuteDataSet("select * from ItemToData"); if (ds.Tables.Count == 0) return list; foreach (DataRow row in ds.Tables[0].Rows) { var data = new ProjInfoData { NumIndex = Convert.ToInt32(row["NumIndex"]), ProjInfo = row["ProjInfo"].ToString(), Unit = row["Unit"].ToString(), }; list.Add(data); } } } return list; }