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

SuperCoder 136 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 '
.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,626 questions
Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,871 questions
VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,661 questions
0 comments No comments
{count} votes

Accepted answer
  1. Jiachen Li-MSFT 29,026 Reputation points Microsoft Vendor
    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 43,051 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