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

Reading From a Delimited file

Hi All,

Please help me its Urgent.In Asp.Net using C# iam trying to write from a file delimited by "|".Iam using SqlDataAdapter fillSchema method.The problem is that a text file which has no header,if the same value is repeated in more than one column,the file which i gave for reading is getting concatenated with the cloumn value.

Can anyone please help me out of this.
1 Solution
Bob LearnedCommented:
You could use a StreamReader, and read in the file on line at a time, and split based on a character:

      System.IO.StreamReader sr = new System.IO.StreamReader(path);

      while (sr.Peek() != -1)

        string input = sr.ReadLine();

        string[] values = input.Split("|".ToCharArray());


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: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

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