• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 203
  • Last Modified:

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.
0
fly412s
Asked:
fly412s
  • 2
  • 2
1 Solution
 
Bob LearnedCommented:
Would it be possible to use XML?  You can read/write XML from a DataSet with the DataSet.ReadXML and DataSet.WriteXML methods.

Bob
0
 
fly412sAuthor Commented:
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
0
 
mpf1748Commented:
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.
0
 
fly412sAuthor Commented:
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.
0
 
mpf1748Commented:
You could have the number of rows to truncate/delete to be specified by the user. Then its not hardcoded.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now