SqlConnection and SqlDataAdapter not found in vb.net 6.0

Anthony White 21 Reputation points
2022-10-31T16:31:22.663+00:00

I am trying to write a simple application to access an SQL database, but cannot reference SqlConnection or SqlDataServer. I've added
System.Data
System.Data.SqlClient
System.Data.OleDb

to the project.

Once again, this is using vb.net 6.0

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,356 questions
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,678 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,568 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 55,366 Reputation points
    2022-10-31T22:52:53.837+00:00

    net 6 no longer includes System.Data.SqlClient as Microsoft.Data.SqlClient is the recommend replacement. you must use a nuget package to induce the old or new package.


  2. Anthony White 21 Reputation points
    2022-11-04T22:04:11.137+00:00

    Thanks for the help.

    I think I am going to just switch to C# for my .NET endeavors.

    I am an old C++ hack. The C# examples work (I've been having a LOT of problems getting the VB examples to work with .NET 6 for what should be simple stuff), and C# just make more sense to me in terms of styling.

    This may be going off topic for this question, but anyone feel free to tell me that I am wrong, and stick with VB...