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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T07:28:23+00:00 2026-06-02T07:28:23+00:00

How would I use a Microsoft Access ( .accdb ) database in C# (console

  • 0

How would I use a Microsoft Access (.accdb) database in C# (console application, not web asp.net)? From what I’ve read, I’ll need to use ADO.NET, but I’m really at a loss as to how to do this in a C# console application. In PHP with MySQL, I’d be looking for mysqli_construct Could anyone point me towards a tutorial or documentation that would help me with that? I’m trying to use it as a way to store and access data for my non-web, non ASP.NET application, if that changes anything.

Thanks!

  • 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-02T07:28:25+00:00Added an answer on June 2, 2026 at 7:28 am

    See this walkthrough for using ADO.NET to edit an Access database.

    Now while that example is using a web application, don’t worry, the classes being used are still applicable for a console application as well.

    The main classes you will need to use are:

    • OleDbConnection
    • OleDbCommand
    • OleDbDataReader

    The documentation of the classes above all have code samples that are console app examples.

    Below is a code snippet for use in a console app (remember to add the: using System.Data.OleDb;

    string connectionString = 
        @"Provider=Microsoft.Jet.OLEDB.4.0;" +
        @"Data Source=C:\path\to\your\database.mdb;" +
        @"User Id=;Password=;";
    
    string queryString = "SELECT Foo FROM Bar";
    
    using (OleDbConnection connection = new OleDbConnection(connectionString))
    using (OleDbCommand command = new OleDbCommand(queryString, connection))
    {
        try
        {
            connection.Open();
            OleDbDataReader reader = command.ExecuteReader();
    
            while (reader.Read())
            {
                Console.WriteLine(reader[0].ToString());
            }
            reader.Close();
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message);
        }
    }
    

    Also, just noticed you explicitly said an .accdb database. For this grab the Microsoft Access Database Engine 2010 Redistributable. The provider in the connection string would then need to be changed to: Microsoft.ACE.OLEDB.12.0 (see notes at that link for more info).

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

Sidebar

Related Questions

I would like to use an SQLite database from Microsoft Access (access from- or
I would like to load some data from an access-database in my C#-application. But
Is it possible to use any other DBMS that is not Microsoft Access to
I'm trying to use the Microsoft Debug Interface Access SDK from C#. This is
How would I use a variable declared in Program.cs and access it's value from
An IT Manager is not allowing the use of SQL Server with an ASP.NET
I am trying to programmatically remove rows from a Microsoft Access Database using a
How would you create a database in Microsoft Access that is searchable only by
I would like to send email from Microsoft Access unattended using VBA. I understand
We have a Visual Basic application inside of Microsoft Access and we need to

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.