Search code examples
.netsql-servervisual-studioentity-frameworkvisual-studio-2022

The connection properties object must be of type SqlConnectionProperties or OleDBSqlConnectionPropertiies


I seem to keep getting this error when trying to create a connection between visual studio 2022 and Sql. (seems to work in VS 2019 when tested on my machine).

From the update Wizard when I click new connection:

enter image description here

when I leave everything as default Microsoft Sql Server as the data source and ".net framework data provider for SQL server" as the data provider.

enter image description here

when I hit continue I get the following error:

enter image description here

the connection properties then seems to load but when i hit OK i get another message:

enter image description here

I can't seem to get it to work.

I've tried updating to the lastest version of visual Studio as well as checking the machine.config for both the 64 bit and 32 bit instances of .net on my machine. As some others have suggested, but to no avail.

in both cases my machine.config looked like so:

  <system.data>
           <DbProviderFactories/>
    </system.data>

I've tried removing the "DbProviderFactories" tag in both and restarted my machine but that didn't seem to make much difference.

<system.data>  </system.data>

I'm not sure if its normal for this to be blank. Perhaps I'm missing some components. but checking the Visual studio installer i seem to already have all the data components downloaded and installed.

Any help would be greatly appreciated.


Solution

  • Managed to solve this. For anyone who also runs into this issue. I had to completely uninstall visual studio 2022 and reinstall .net framework 4.81 runtime followed by the SDK. After doing this I reinstalled Visual studio 2022 and my machine. Upon loading my solution and trying to add the connection I no longer get the message and am able to connect to my DB.