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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T04:09:38+00:00 2026-06-01T04:09:38+00:00

A project I’m working on contains an MDB (acecss database) file. I’d like to

  • 0

A project I’m working on contains an MDB (acecss database) file. I’d like to export the contents of the tables to text, but am having a hard time finding a way to do it easily using C#. Is there a faster way than using OLEDB and queries?

Update:
Ideally I’d like to not have to statically name each table (there are hundreds) and I have to use .NET 2.0 or below.

  • 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-01T04:09:39+00:00Added an answer on June 1, 2026 at 4:09 am

    There might be a more efficient way, but you could populate the data into a DataTable, and then export to a text file:

    Getting data into the DataTable:

    string connString = "Provider=Microsoft.ACE.OLEDB.12.0;data source=C:\\marcelo.accdb";
    
    DataTable results = new DataTable();
    
    using(OleDbConnection conn = new OleDbConnection(connString))
    {
        OleDbCommand cmd = new OleDbCommand("SELECT * FROM Clientes", conn);
        conn.Open();
        OleDbDataAdapter adapter = new OleDbDataAdapter(cmd);
        adapter.Fill(results);
    }
    

    Exporting the DataTable to CSV:

    EDIT I haven’t tested this, but something like this should work for .NET 2.0.

    //initialize the strinbuilder
    StringBuilder sb = new StringBuilder();    
    
    //append the columns to the header row
    string[] columns = new string[dt.Columns.Count - 1];
    for (int i = 0; i < dt.Columns.Count; i++)
        columns[i] = dt.Columns[i].ColumnName;
    sb.AppendLine(string.Join(",", columns));          
    
    foreach (DataRow row in dt.Rows)
    {
        //append the data for each row in the table
        string[] fields = new string[row.ItemArray.Length];
        for (int x = 0; x < myDataRow.ItemArray.Length; x++)        
            arr[x] = row[x].ToString();                
        sb.AppendLine(string.Join(",", fields));
    }
    
    File.WriteAllText("test.csv", sb.ToString());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Project file here if you want to download: http://files.me.com/knyck2/918odc So I am working on
Project info: WPF, PRISM, C# 4.0, WCF, Entity framework, SQL(express) My database contains several
A project I'm working on at the moment involves refactoring a C# Com Object
My project has both client and server components in the same solution file. I
Project I'm working on uses jQuery. I have a series of Ajax calls being
Project A contains a WPF Window (Data Entry Form) with a stack panel of
Project being built on ASP.net v 2 VB.net IIS 6 SQL Server 2005 database
Project Euler has a paging file problem (though it's disguised in other words). I
The project I am currently working on has, in the checkout, an option to
A project has 3 tables : client, invoices, deliveries The relations are: client has_many

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.