The connection properties object must be of type SqlConnectionProperties or OleDBSqlConnectionPropertiies – .net

by
Alexei Petrov
.net-4.8 entity-framework-core sql-server visual-studio-2022

Quick Fix: If you encounter the error "The connection properties object must be of type SqlConnectionProperties or OleDBSqlConnectionPropertiies", consider uninstalling and reinstalling Visual Studio 2022 and .NET Framework 4.81 runtime.

The Problem:

A user is unable to establish a connection between Visual Studio 2022 and SQL Server. When attempting to create a new connection, the error "The connection properties object must be of type SqlConnectionProperties or OleDBSqlConnectionPropertiies" occurs. This issue persists despite using default settings and updating the Visual Studio version and checking the machine.config files. Modifying the machine.config files by removing the "DbProviderFactories" tag or leaving it empty did not resolve the issue. The user suspects that some components might be missing despite having all data components downloaded and installed.

The Solutions:

Solution 1: Uninstalling and Reinstalling Visual Studio and .NET Framework

Title: Uninstall and Reinstall Visual Studio and .NET Framework

Solution Body:

To resolve the issue where you receive the error, "The connection properties object must be of type SqlConnectionProperties or OleDBSqlConnectionPropertiies" when creating a connection between Visual Studio 2022 and SQL, follow these steps:

  1. Uninstall Visual Studio 2022:

    • Open the Control Panel or Settings app on your computer.
    • Navigate to the "Programs and Features" or "Apps" section.
    • Locate Visual Studio 2022 in the list of installed programs.
    • Select it and click "Uninstall" or "Remove."
    • Follow the prompts to complete the uninstallation.
  2. Reinstall .NET Framework 4.81 Runtime and SDK:

    • Go to the Microsoft .NET Framework 4.81 download page.
    • Download and install the runtime and SDK for your operating system.
    • Make sure to select the correct version (x86 or x64) for your system.
  3. Reinstall Visual Studio 2022:

    • Visit the Visual Studio download page.
    • Download and install the latest version of Visual Studio 2022.
    • Select the "Custom" installation type and make sure to include the "Data Storage and Processing" workload.
  4. Test the Connection:

    • Open Visual Studio 2022 and load your solution.
    • Attempt to add a new connection to your database.
    • You should no longer receive the error message.

Solution 2: Install the missing package

The error is prompted when the required package is missing from your Visual Studio installation. To fix this issue, you can follow these steps:

  1. Open Visual Studio Installer. You can search for it in the Start menu.
  2. Go to the Individual Components tab.
  3. Under the Programming languages section, find and install the Data Storage and Processing workload.
  4. Once the installation is complete, restart Visual Studio.
  5. Try creating a new SQL connection again.

Q&A

What is the cause of the error ‘Connection properties object must be of type SqlConnectionProperties or OleDBSqlConnectionPropertiies’?

Missing components or outdated .NET framework version.

How to resolve the error?

Uninstall Visual Studio 2022, reinstall .NET Framework 4.81 runtime and SDK, then reinstall Visual Studio 2022.

What should be done if the error persists?

Install the missing package in the Visual Studio installer.

Video Explanation:

The following video, titled "How to fix error SQL Connection in Visual Studio 2019 - YouTube", provides additional insights and in-depth exploration related to the topics discussed in this post.

Play video

How to fix error SQL Connection in Visual Studio 2019 Thanks you for watching my videos Please subscribe my channel #FixVisualStudio2019.