-
datagrid
A win datagrid is populated by a dataset.
This dataset varies for each population. i.e sometimes 4 fields and sometimes more or less...
I would like to transfer this dataset and populate it into excel sheet.
How can a dataset or the data in a datagrid be transfered into excel sheet.
If I was using a DataReader I know how to loop through it and populate the excel sheet but with the Dataset I do not know
Thanks
-
you can loop through a dataset like this :
a dataset exists of one or more datatables so let's assume you have only one table in it.
you can do this :
dim dt as datatable = ds.tables(0)
dt.rows.count (so you know the qty of rows in table with index 0.)
for i=0 to dt.rows.count
dt.rows(0)(i) '-> this gives you row by row from column0
next
This code is untested but it will help you for sure !
HTH
Bjorn