[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Reading From a Delimited file

Posted on 2005-04-21
3
Medium Priority
?
186 Views
Last Modified: 2010-04-16
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.
0
Comment
Question by:osmidhun
1 Comment
 
LVL 96

Accepted Solution

by:
Bob Learned earned 200 total points
ID: 13832991
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());

      }

Bob
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Screencast - Getting to Know the Pipeline
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question