Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8316285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T21:19:40+00:00 2026-06-08T21:19:40+00:00

I am using asp.Net MVC application to upload the excel data from its CSV

  • 0

I am using asp.Net MVC application to upload the excel data from its CSV form to database. While reading the csv file using the Stream Reader, if line contains lower case letter followed by Upper case, it splits in two line . EX.

Line :"1,This is nothing but the Example to explanationIt results wrong, testing example"
This line splits to :
Line 1: 1,This is nothing but the Example to explanation"
Line 2:""
Line 3:It results wrong, testing example

where as CSV file generates right as “”1,This is nothing but the Example to explanationIt results wrong, testing example”

code :
  Dim csvFileReader As New StreamReader("my csv file Path")
     While Not csvFileReader.EndOfStream()
                        Dim _line = csvFileReader.ReadLine()

                    End While

Why should this is happening ? how to resolve this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T21:19:41+00:00Added an answer on June 8, 2026 at 9:19 pm

    When a cell in an excel spreadsheet contains multiple lines, and it is saved to a CSV file, excel separates the lines in the cell with a line-feed character (ASCII value 0x0A). Each row in the spreadsheet is separated with the typical carriage-return/line-feed pair (0x0D 0x0A). When you open the CSV file in notepad, it does not show the lone LF character at all, so it looks like it all runs together on one line. So, in the CSV file, even though notepad doesn’t show it, it actually looks like this:

    ' 1,"This is nothing but the Example to explanation{LF}It results wrong",testing example{CR}{LF}
    

    According to the MSDN documentation on the StreamReader.Readline method:

    A line is defined as a sequence of characters followed by a line feed (“\n”), a carriage return (“\r”), or a carriage return immediately followed by a line feed (“\r\n”).

    Therefore, when you call ReadLine, it will stop reading at the end of the first line in a multi-line cell. To avoid this, you would need to use a different “read” method and then split on CR/LF pairs rather than on either individually.

    However, this isn’t the only issue you will run into with reading CSV files. For instance, you also need to properly handle the way quotation characters in a cell are escaped in CSV. In such cases, unless it’s really necessary to implement it in your own way, it’s better to use an existing library to read the file. In this case, Microsoft provides a class in the .NET framework that properly handles reading CSV files (including ones with multi-line cells). The name of the class is TextFieldParser and it’s in the Microsoft.VisualBasic.FileIO namespace. Here’s the link to a page in the MSDN that explains how to use it to read a CSV file:

    http://msdn.microsoft.com/en-us/library/cakac7e6

    Here’s an example:

    Using reader As New TextFieldParser("my csv file Path")
        reader.TextFieldType = FieldType.Delimited
        reader.SetDelimiters(",")
        While Not reader.EndOfData
            Try
                Dim fields() as String = reader.ReadFields()
                ' Process fields in this row ...
            Catch ex As MalformedLineException
                ' Handle exception ...
            End Try
        End While
    End Using
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using .NET 3.5 SP1 in ASP.NET MVC application. While using ObjectContext with Http
I wrote a simple file upload application using ASP.NET MVC. I tested it successfully
I am using Uploadify to upload multiple files in my ASP.NET MVC application. In
I'm trying to create a upload center application using Asp.Net MVC 4. I want
I am using asp.net mvc for an application. I've taken some guidance from Rob
I've made some graphs in my ASP.Net MVC application using the ASP.Net MSChart control.
In my ASP.NET MVC application I am using a select list control to generate
In my ASP.NET MVC application i am using Chinese Category Name, it was displayed
I wrote an application using ASP.NET MVC, in this application I have an Index
I have an ASP.NET MVC application using Authorization Attributes on Controllers and Actions. This

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.