private void button2_Click(object sender, EventArgs e)
{
OleDbConnection cn = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;data source=c://library//lib.mdb");
OleDbDataAdapter cmd = new OleDbDataAdapter("select * from entry where LTRIM(subjet)=?", cn);
cmd.SelectCommand.Parameters.AddWithValue("1", comboBox1.Text);
DataSet fg = new DataSet();
cmd.Fill(fg);
label1.Text = "No. of Rows:- " + fg.Tables[0].Rows.Count.ToString();
dataGridView1.DataSource = fg.Tables[0];
}
private void button2_Click(object sender, EventArgs e) { OleDbConnection cn = new OleDbConnection(Provider=Microsoft.ACE.OLEDB.12.0;data source=c://library//lib.mdb); OleDbDataAdapter
Share
If this is a simple, small application then something like this would suffice…
If this is a complex application that you will want to look into multi-tier application design.