How C# connection to Access DB without MS Access? - c#

What do I need to do so that I can work with Access DB database file in C# without installing MS Access?
I make a program for a computer on which MS Access is not installed

You don't need to install the office setup in your system, but you do need to install either the ACE or the JET engine driver with the correct bit version to use Access files in your code. The 32 bit engine driver will not work with 64 bit OS version and vice versa.
Have a look here:
for download and instruction
https://www.microsoft.com/en-gb/download/details.aspx?id=13255
for access connecetion strings
https://www.connectionstrings.com/access/

Related

installing database engine without admin rights

I have a project with vb-2013 and my database is access 2013.
When I run my project on another computer this error appears:
Microsoft.ACE.OLEDB.12.0 provider is not registered on the local
machine error
Is there a way to install a Microsoft database engine without admin rights because of security policies
or
adding any dll file to my project to run it without installing Microsoft database engine.
Not to my knowledge, no. All ODBC and OLE-DB driver binary registrations are handled by systemwide controls. ODBC does allow for per-user connection settings, it still requires systemwide binary installation. If you're writing a "portable" (installation-free) application I recommmend using Sqlite instead.
As an aside, there are very few reasons to use JET Red (MS Access) today over actively-developed systems like Sqlite considering how limited the tooling is, and how SQL implementation is non-standard (e.g. it doesn't support COALESCE and it also requires a parenthesis pair around every JOIN) .

How can we set oledb provider for 64 bit operating system

I want to get oledb provider for jet 4.0 in my sql. I am using 64 bit version of windows.
I have created a linked server to access the access database and import that database to sql.
So, I have written one stored procedure to create a linked server there i mentioned provider as Microsoft oledb jet 4.0.
I got error like this in 64 bit
'OLE DB provider 'Microsoft.Jet.OLEDB.4.0' cannot be used for distributed queries because the provider is configured to run in single-threaded apartment mode.'
In 32 bit windows it is working fine. I installed microsoft oledb jet drivers. But in 64 bit It is not being installed.
Can u pls tell me the suggestion to get provider oledb jet 4.0 in Sql linked servers.
When you need to use MS Access database, you need to install a database access engine. Check the link: https://www.microsoft.com/en-us/download/details.aspx?id=13255 Also consider the version of the Access you have installed on the host machine in your connection string.
For me what works is to install the database driver from:
The 2016 Access Redistributable
https://www.microsoft.com/en-us/download/details.aspx?id=54920
And then adjust my connection string for example:
connection.ConnectionString = #"Provider=Microsoft.ACE.OLEDB.16.0;Data Source=F:\SKS\SKSDatabase\Orders.mdb";

How to Access database files without Access Database Engine

I'm currently using access database engine 2010 (AccessRuntime 2013) to open and query various database files, .xls, .xlsx, .accessdb, .xml, .txt/csv/tab, .mdb, .dbf, etc...
But now I need to build a x64 application to do the same. However this creates a problem, on x64 PC's that still run Ms Office x86 or have other applications that use the x86 Access Database engine 2010.
The Access x64 runtime wont install next to the x86 version (you can force Access Database engine 2010 with /passive but this damages the x86 version and stops some applications to work at all (including old versions of my own software).
I've read a tone of topics about this issue, but never a solution.
I'm searching for an alternative to the Microsoft access database engine/runtime that allowes me to query various database files in C# or C++
Does anyone have any suggestions how to achieve this?

Connecting Visual C# 2008 to MS Access 2010 x64

I'm trying to connect to one of my MS Access databases in Visual C# 2008, problems is the MS Access 2010 is x64 and I'm using Windows 7 x64 and it doesn't see any Access driver for 64 bit architecture in ODBC, so my question is, is there any drivers available or fix for it or do I have to reinstall MS Access in x86?
I know I can use SQL for the database but would prefer to use Access as its easier for me.
Thanks in advance
"Currently Microsoft does not have any 64 bit ODBC drivers available for the Office products.
However, as long as the application that you want to connect to is 32 bit, you can use the 32 bit ODBC drivers to create the DSN. To get to the 32 bit ODBC drivers, the 32 bit Data Source administrator must be used. The 32 bit Data Source administrator must be launched directly if you are using a 64 bit OS. The file should be located at the following path:c:\windows\sysWOW64\odbcad32.exe..."
From the following link : http://answers.microsoft.com/en-us/office/forum/officeversion_other-access/64-bit-driver-for-dsn-for-ms-access-database/be8c0ad4-d8fd-48e0-9026-b95d84135820
You have to force your VS project(s) to use x86 processers:
double click the
then set the Platform target

Alternative to Microsoft.Jet.OLEDB.4.0 for 64 bit access on MDB File

I have like many others the problem that I can't access Microsoft Access (MDB Files) from my 64 bit machine using Microsoft.Jet.OLEDB.4.0.
I know that there's no 64bit version of it, and that I need to compile it against x86.
So my question is:
Do you know any other .NET Providers for Microsoft Access that supports 64bit access?
To get 64 bit Microsoft Access drivers download the Microsoft Access Database Engine 2010 Redistributable. You cannot install that with a 32 bit version of Microsoft Office installed.
The ODBC connection string with that driver is "Driver={{Microsoft Access Driver (*.mdb, *.accdb)}};Dbq=%FILE_NAME%;Uid=Admin;Pwd=;". The OleDb connection string for that driver is "Provider=Microsoft Office 12.0 Access Database Engine OLE DB Provider;Data Source=%FILE_NAME%;User Id=admin;Password=;.
For Windows server 2003, there is the MSDASQL that offer an OLEDB provider for ODBC, which can connect to Access. It is available in 64bits.

Categories