grid view with coding in access database .net windows application with c#

string str=@" ";
public void grid()
        {
            OleDbConnection con = new OleDbConnection(str);
            con.Open();
            OleDbCommand cmd = new OleDbCommand("SELECT * FROM  tablename", con);
            OleDbDataAdapter da = new OleDbDataAdapter(cmd);
            DataSet ds = new DataSet();
            da.Fill(ds);
            dataGridView1.DataSource = ds.Tables[0];
            con.Close();
        }    


  private void form_Load(object sender, EventArgs e)
        {
             grid();
        }

Ebook Download
View all
Learn
View all