public void viewitem(DataGridView v) { connection.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\oop data base for oil.accdb; Persist Security Info=False;"; try { connection.Open(); OleDbCommand command = new OleDbCommand(); command.Connection = connection; command.CommandText = "select * from oilstock"; OleDbDataAdapter da = new OleDbDataAdapter(command); DataTable dt = new DataTable(); da.Fill(dt); viewitems vi = new viewitems(); vi.Activate(); v.DataSource = dt; connection.Close(); } catch (Exception ex) { MessageBox.Show("error" + ex); } }
private void button2_Click(object sender, EventArgs e) { viewitems vi = new viewitems(); vi.Show(); // da.Fill(dt); // itemsview. Hide(); }