"Type SqlDataAdapter is not defined" after migrating from .net framwork to .net 7

SuperCoder 236 Reputation points
2023-12-03T21:41:17.79+00:00

After upgrading my project to .NEG 7.0 we now receiver an error message when using commands such as New SqlConnection and New SqlDataAdapter. Errors are "Type SqlConnection is not defined" and "Type SqlDataAdapter is not defined"

How do I fix this?

Imports System.Data.SqlClient '
Developer technologies | .NET | Other
Developer technologies | VB
Developer technologies | Visual Studio | Other
0 comments No comments
{count} votes

Accepted answer
  1. Jiachen Li-MSFT 34,221 Reputation points Microsoft External Staff
    2023-12-04T08:59:34.9633333+00:00

    Hi @SuperCoder ,

    You have to install the System.Data.SqlClient package from the Nuget Package Manager.

    User's image

    Best Regards.

    Jiachen Li


    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


1 additional answer

Sort by: Most helpful
  1. RLWA32 49,541 Reputation points
    2023-12-03T22:16:21.1566667+00:00

    According to the documentation at System.Data.SqlClient Namespace the project needs to target .Net 8

    0 comments No comments

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.