Datatable.Clear() method please help

C

cameljs18

I have a datatable into which i insert data then display the data in a
datagridview.When i want to clear the table and place completely new
data in the table, the table still retains the column headers(this is
using the datatable.Clear() method).The table then adds the new
headers to the old which results in empty columns.Please inform me how
to clear the data completely.thanks
 
Q

QC

Datatable.Clear() methods clears only the data.

if you want to remove / clear all columns as well from it, use
DataTable.Columns.Clear() method.
 
C

cameljs18

I have a datatable into which i insert data then display the data in a
datagridview.When i want to clear the table and place completely new
data in the table, the table still retains the column headers(this is
using the datatable.Clear() method).The table then adds the new
headers to the old which results in empty columns.Please inform me how
to clear the data completely.thanks

thanks works fine now
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top