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

  • Home
  • SEARCH
  • 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 8936491
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:13:28+00:00 2026-06-15T10:13:28+00:00

At the moment, I source my data from a SQL serve r(2008) database. The

  • 0

At the moment, I source my data from a SQL serve r(2008) database. The cyurrent method is to use a DataTable, which is then passed around and used.

    if (parameters != null)
    {
        SqlDataAdapter _dataAdapter = new SqlDataAdapter(SqlQuery, CreateFORSConnection());
        foreach (var param in parameters)
        {
            _dataAdapter.SelectCommand.Parameters.AddWithValue(param.Name, param.Value);
        }
        DataTable ExtractedData = new DataTable(TableName);
        _dataAdapter.Fill(ExtractedData);
        return ExtractedData;
    }
    return null;

But now, the user has said that we can also get data from txt files, which have the same structure as the tables in SQL Server. So, if I have a table called ‘Customer’, then I have a csv file with Customer. with the same column structure. The first line in the CSV is the column name, and matches my tables.

Would it be possible to read the txt file into a data table, and then run a SELECT on that data table somehow? Most of my queries are single table queries:

SELECT * FROM Table WHERE Code = 111

There is, however, ONE case where I do a join. That may be a bit more tricky, but I can make a plan. If I can get the txt files into data tables first, I can work with that.

Using the above code, can I not change the connection string to rather read from a CSV instead of SQL Server?

  • 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-15T10:13:29+00:00Added an answer on June 15, 2026 at 10:13 am

    First, you’ll need to read the CSV data into a DataTable. There are many CSV parsers out there, but since you prefer using ADO.NET, you can use the OleDB client. See the following article.

    http://www.switchonthecode.com/tutorials/csharp-tutorial-using-the-built-in-oledb-csv-parser

    Joining is a bit harder, since both sets of data live in different places. But what you can do is get two DataTables (one from each source), then use Linq to join them.

    Inner join of DataTables in C#

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a T-SQL script that migrates some data from one database to
I need to fill a UITableView from an NSSet data source. Obviously I want
I'm trying to use jQueryUI draggable/droppable/sortable to move (not copy) items from a source
I'm using integration services (SSIS), at the moment I'm getting the data from an
I have a Linq query that returns an anonymous type, which I then use
I have a situation which involves several threads simultaneously populating a database with data
I want to use one data source (e.g. an Array) for multiple Datagrids that
I'm doing a data migration at the moment of a subset of data from
I have to request data for a JS-script from a MySQL database (based upon
I need to import some data obtained from an Indonesian file, part of which

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.