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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:05:12+00:00 2026-06-14T17:05:12+00:00

I have taken over an application written by another developer, which reads data from

  • 0

I have taken over an application written by another developer, which reads data from a database, and exports it.

The developer used DataTables and DataAdaptors.

So,

 _dataAdapter = new SqlDataAdapter("Select * From C....", myConnection);

and then

ExtractedData = new DataTable("CreditCards");
_dataAdapter.Fill(ExtractedData);

ExtractedData is then passed around to do different functions.

I have now been told that I need to, in addition to this, get the same format of data from some comma separated text files. The application does the same processing – it’s just getting the data from two sources.

So, I am wondering if I can get the data read into a DataTable, as above, and then ADD more records from a CSV file.

Is this possible?

  • 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-14T17:05:15+00:00Added an answer on June 14, 2026 at 5:05 pm

    You might need to use this function to read the data into DataTable from the file.

    public DataTable GetDataSourceFromFile(string fileName)
    {
        DataTable dt = new DataTable("CreditCards");
        string[] columns = null;
    
        var lines = File.ReadAllLines(fileName);
    
        // assuming the first row contains the columns information
        if (lines.Count() > 0)
        {
            columns = lines[0].Split(new char[] { ',' });
    
            foreach (var column in columns)
                dt.Columns.Add(column);
        }
    
        // reading rest of the data
        for (int i = 1; i < lines.Count(); i++)
        {
            DataRow dr = dt.NewRow();
            string[] values = lines[i].Split(new char[] { ',' });
    
            for (int j = 0; j < values.Count() && j < columns.Count(); j++)
                dr[j] = values[j];
    
            dt.Rows.Add(dr);
        }
        return dt;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I've taken over a VB.net web application project from another developer and have
I have taken over an application from a previous developer, and there was some
I have taken over some code from a previous developer and have come across
So I have taken over a Java Web project . The application was written
I have taken over a project that was build from suggestions in this Dan
i have taken over a database that stores fitness information and we were having
I have taken over an existing project written beautifully in SQL with many useful
I have taken over a Windows-CE 6.0 application that I would like to port
I have taken over a medium sized project that was written originally using RoR.
I have recently taken over an application that uses the Peter Blum Date and

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.