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 3781856
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T11:00:04+00:00 2026-05-19T11:00:04+00:00

In my website I am reading a CSV file and parsing it. Now the

  • 0

In my website I am reading a CSV file and parsing it. Now the CSV does not have a column names. It is simply a raw list of comma seperated values.

I take this file and use the ODBCDataReader class to read the rows.

The problem is that when I retrieve the first value it skips the first row of the CSV. This is probably because it considers first row as column header. But in my case there are no column headers. So every time my first row is skipped.

How can I retrieve the first row of my CSV?

Here is the screenshot of my CSV:

alt text

Here is the code that I am using to parse the CSV.

public string CsvParser()    
{    
    int _nNrRowsProccessed = 0;
    string connectionString = @"Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" + ConfigurationManager.AppSettings["CSVFolder"] + ";";     
    OdbcConnection conn = new OdbcConnection(connectionString);     
    try
    {
        conn.Open();

        string strFileName = ConfigurationManager.AppSettings["CSVFile"];
        string strSQL = "Select * from " + strFileName;

        OdbcCommand cmd = new OdbcCommand();
        cmd.Connection = conn;
        cmd.CommandText = strSQL;
        cmd.CommandType = CommandType.Text;

        OdbcDataReader reader = cmd.ExecuteReader();
        string strLine = null;

        // MasterCalendar_DB.OpenMySQLConnection();

        while (reader.Read())
        {
            // insert data into mastercalendar
            strLine = reader[0].ToString();
            string strLine1 = reader[1].ToString();
            string strLine2 = reader[2].ToString();
            string strLine3 = reader[3].ToString();
            string[] arLine = strLine.Split(';');

           // string strAgencyPropertyID = arLine[0];
           // DateTime dt = DateTime.Parse(arLine[1]);
           // Int64 nDate = (Int64)Util.ConvertToUnixTimestamp(dt);
           // String strAvailability = (arLine[2]);

            _nNrRowsProccessed++;
           // MasterCalendar_DB.Insert(strAgencyPropertyID, nDate, strAvailability);
        }     
    }
    catch (Exception ex)
    {
        throw ex;
    }
    finally
    {
        conn.Close();
       // MasterCalendar_DB.CloseMySQLConnection();
    }
    return "Success";
}
  • 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-05-19T11:00:04+00:00Added an answer on May 19, 2026 at 11:00 am

    You want to have a look at the page of the Text-Driver over at connectionstrings.org.

    Basically, you create a schema.ini in the same directory, which holds varies options. One of them is the ColNameHeader option, which takes a boolean.

    Example from the site:

    [customers.txt]
    Format=TabDelimited
    ColNameHeader=True
    MaxScanRows=0
    CharacterSet=ANSI
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am reading in large csv file using read.csv . Several websites suggest using
I have been reading through this wonderful website regarding the recommended Python IDEs and
From what I have been reading on The Open Group website on fcntl ,
I have been reading Yahoo's Best Practices For Speeding Up Your Website , but
Hi I have a website's home page that I am reading in using Curl
Love this website! My issue is as follows: I'm reading a zip file that's
I have been reading around about best practices when doing developing a website. But
Thanks for reading my question. I have a website that uses PHP for a
I have an asp.net-mvc website and i am reading in Json string from a
I've been reading up on the best way to handle images for a website

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.