1

I am trying to create an .net core asp mvc app which will read/write to an MS Access database.

I can't seem to find any information on how this can be achieved, or whether it is in fact possible, apart from this question, but none of the answeres there actually give any useful informtion.

For instance the top answer suggests using Access Database Engine, but there is no mention on how to actually connect to it.

The next answer talks about using Jet, but I got stuck with this issue, and it seems that its not actually supported in dotnet core..

Is it actually the case that I can't access a .mdb file using dotnet core?

If it is possible, could anyone point me towards some sample code or give any guidance as to how this can be done?

2 Answers 2

1

You need a custom Connection String that will allow you to access the .mdb file. Use this as your connection string building reference.

You could then instantiate a connection towards the database like this:

using (OleDbConnection connection = new OleDbConnection(ConnectionString)){

     connection.Open();

}
Sign up to request clarification or add additional context in comments.

2 Comments

I can't seem to call OleDbConnection (no such class or type)
have you tried adding using System.Data.OleDb; to the beginning of the file? Also you might need to import that reference manually.
0

I think the use of OLE DB is deprecated in .net core as per this article.

What about OLE DB? OLE DB has been a great way to access various data sources in a uniform manner, but it was based on COM, which is a Windows-only technology, and as such was not the best fit for a cross-platform technology such as .NET Core. It is also unsupported in SQL Server versions 2014 and later. For those reasons, OLE DB won’t be supported by .NET Core.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.