private void Button_Click(object sender, RoutedEventArgs e) { /* * Microsoft.Win32.OpenFileDialog openFileDialog = new Microsoft.Win32.OpenFileDialog(); * openFileDialog.Multiselect = false; * openFileDialog.Filter = "AllFiles|*.*"; * openFileDialog.ShowDialog(); * dataBaseAddress = openFileDialog.FileName; * string constring = databaseCon + dataBaseAddress; * OleDbConnection connection = getConn(constring); * String selectString = "select * from config1"; * OleDbCommand command = new OleDbCommand(selectString, connection); * connection.Open(); * OleDbDataAdapter adapter = new OleDbDataAdapter(); * DataSet dataTable = new DataSet(); * //OleDbCommand command = new OleDbCommand(selectString, connection); * adapter.SelectCommand = command; * adapter.Fill(dataTable); * dataTable.Tables[0].PrimaryKey = new DataColumn[] { dataTable.Tables[0].Columns[0] }; * dg.ItemsSource = dataTable.Tables[0].DefaultView; * DataRow dr = dataTable.Tables[0].NewRow(); * connection.Close(); */ InsertFile insertFile = new InsertFile(); insertFile.insertFile(id, files); dg.ItemsSource = null; dg.ItemsSource = files; id++; }
//新建配置信息 private void Button_Click_2(object sender, RoutedEventArgs e) { InsertFile insertFile = new InsertFile(); insertFile.insertFile(id, files); dg.ItemsSource = null; dg.ItemsSource = files; id++; }