Copy a DataTable
we can do copy of datatable with the help of copy();
private void button1_Click(object sender, EventArgs e)
{
OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\\student.mdb");
con.Open();
OleDbCommand cmd =new OleDbCommand("select * from marks", con);
DataTable tb = new DataTable();
tb.Load(cmd.ExecuteReader(CommandBehavior.CloseConnection));
DataTable copytable = tb.Copy();
tb = null;
dataGridView1.DataSource = copytable;
}
No comments:
Post a Comment