private void button1_Click(object sender, RoutedEventArgs e) { connectionstring = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:/Project/Book.accdb"; connection = new OleDbConnection(connectionstring); sql = "Select*from Authors"; DataGrid dg2 = new DataGrid(); try { connection.Open(); oledbAdapter = new OleDbDataAdapter(sql, connection); oledbAdapter.Fill(dt); dg2.DataContext = dt; connection.Close(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } dg2.HorizontalAlignment = HorizontalAlignment.Left; dg2.VerticalAlignment = VerticalAlignment.Top; dg2.Height = 700; dg2.Width = 900; dg2.Background = Brushes.YellowGreen; grid1.Children.Add(dg2); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)