Delete empty rows in a dataset?

ThienZ

Well-known member
Joined
Feb 10, 2005
Messages
45
Location
Germany
i fill a strongly typed dataset from excel, and then i write the sourcefilename, source sheet, and rownr into the columns filename, sheetname and rownr in the dataset.

however excel takes takes the empty rows too into the dataset. like if the sheet has 100 active rows, but actually only the first 10 rows has values, the oledbdatadapter fill the dataset with these 100 rows and all the "cells" in the dataset in row 11-100 has (Null).

i have some ideas :
- before i write the filename, sheet, and rownr, i filter all the empty rows manually. i go through all rows and for each row i check the cell. if they are empty i delete them. but then i dont know anymore which row which rownr has (because there would be an empty row in the middle too)
- after i write the filename, sheetname and rownr i go through all rows and for each row i transpose it, put it in a new dataset, sort it, and see if the 4th row has a value. if no then i can delete this row.

does anyone has a better idea? (im sure there are many better ways.....)
 
i took a peek to w3schools xsl tutorial site, and i wonder if it would be easier if i filter the rows in xsl because i have 167 columns in this dataset im working on. and it seems that xsl is more likely for web purposes? im using dataset to work on excel sheets...
 
Back
Top