Link to home
Start Free TrialLog in
Avatar of fly412s
fly412s

asked on

Cleaning a file for use as a flat file database

I have a comma deliminated text file (.csv) I have to use in a program.  The first two rows in the file are blank.  The actual field names (column headers) begin in the 3rd row.  What is the best way to delete those first two rows.  Is there a way to have the person using the program select the row in which the field titles begin and then delete up to that row and reload the file into the database?

Thanks.
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Would it be possible to use XML?  You can read/write XML from a DataSet with the DataSet.ReadXML and DataSet.WriteXML methods.

Bob
Avatar of fly412s
fly412s

ASKER

I might be able to use XML.  I won't know until this Friday, the 13th of May.  I'll be traveling up to my client the end of this week.  I'll check their systems capabilities.

Thank-you,

Tom
If you are using a StreamReader, you can simply call ReadLine x number of times without doing anything with the result. x can either be hardcoded or an value that the user supplies. Then do something with the remaining lines.
Avatar of fly412s

ASKER

I agree, however, I was looking for a more elegant way such as presenting the file in its entirety via a datagrid or something similar.  Then allowing the user to select the row with the names of the fields (or column headers).  The issue is hardcoding a value and then the structure of the file might change.
ASKER CERTIFIED SOLUTION
Avatar of mpf1748
mpf1748
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial