how to fix "Failed to load microsoft.date.sqlclient version = 5.0.0.0 file or assembly..."

Efrem 20 Reputation points
2025-01-28T12:32:37.71+00:00

oHIRyXA4

I tried to recreate projects, installed the access engine, added microsoft.data.sqlclient through nuGet, installed various database extensions, watched a lot on the Internet, nothing helped. I need to add an access database. What should I do?

Access
Access
A family of Microsoft relational database management systems designed for ease of use.
437 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,262 questions
Access Development
Access Development
Access: A family of Microsoft relational database management systems designed for ease of use.Development: The process of researching, productizing, and refining new or existing technologies.
897 questions
{count} votes

Accepted answer
  1. Karen Payne MVP 35,551 Reputation points
    2025-01-28T18:37:38.4+00:00

    As Olaf indicated, you are targeting the wrong package; the target must be as shown below for a .NET Core project.

    Also,

    • Consider upgrading your .mdb database to a .accdb database.
    • Keep away from TableAdaper; look at EF Core Jet provider or Dapper

    In your project file

    <ItemGroup>
       <PackageReference Include="System.Data.OleDb" Version="8.0.0" />
    </ItemGroup>
    
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Olaf Helper 45,776 Reputation points
    2025-01-28T12:41:02.1066667+00:00

    microsoft.data.sqlclient

    That data provider/namespace is to connect & work with MS SQL Server.

    For MS Access database use System.Data.OleDb Namespace instead.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.