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?

Microsoft 365 and Office | Access | Development
Microsoft 365 and Office | Access | For business | Windows
Developer technologies | C#
{count} votes

Accepted answer
  1. Karen Payne MVP 35,586 Reputation points Volunteer Moderator
    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 47,436 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.