Results 1 to 2 of 2

Thread: [2.0] Need to read and Ascii file

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2003
    Posts
    436

    [2.0] Need to read and Ascii file

    Howdy all,

    I need to read ascii files (comma separated) using C# .

    Which libraries or namespaces should I be using to accomplish.

    thanks
    nath

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2.0] Need to read and Ascii file

    You can use ADO.NET to access CSV files in a folder as though they were tables in a database. As is always the case with ADO.NET, it is almost exactly the same as using any other data source. See www.connectionstrings.com for more details.

    Alternatively you can use a StreamReader to read the file all at once or line by line. You can then use the String.Split method to separate a line into an array of strings with the delimiters removed. There are examples all over the forums, although the majority may be in VB.NET.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width