Asked by:
Error - The type name 'SqlCommand' could not be found in the namespace 'System.Data.SqlClient'

Question
-
User1979860870 posted
Hi
I have included using system.data.sqlclient but i am getting below error.
Using Sql 2019 Community Edition
Severity Code Description Project File Line Suppression StateError CS1069 The type name 'SqlCommand' could not be found in the namespace 'System.Data.SqlClient'. This type has been forwarded to assembly 'System.Data.SqlClient, Version=4.6.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' Consider adding a reference to that assembly. EmployeeManagement C:\Users\Main\source\repos\EmployeeManagement\EmployeeManagement\Models\DepartmentDataAccessLayer.cs 114 ActiveThanks
Tuesday, December 15, 2020 5:51 AM
All replies
-
User1120430333 posted
This type has been forwarded to assembly 'System.Data.SqlClient, Version=4.6.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
That's the DLL version where SqlCommand is at version 4.6.1.0. Are you using that version of the DLL in the project? You can use Nuget on the project and verify what installed version of System.Data.SqlClient is being used by the project.
Tuesday, December 15, 2020 6:50 AM -
User1979860870 posted
Hi
In Nuget when click on installed it shows nothing. How i can check
Thanks
Tuesday, December 15, 2020 7:05 AM -
User1120430333 posted
You can drop down to the Bin folder for the project and find the DLL and look at information in Properties to get the version number, by right clicking the file.
Sorry, I am posting from my tablet so I can't tell you off hand how to do it in Visual Stuido
Tuesday, December 15, 2020 11:01 AM -
User-474980206 posted
System.Data.SqlClient is obsolete. It is no longer included in the framework, but must be installed as a nuget package. See
https://devblogs.microsoft.com/dotnet/introducing-the-new-microsoftdatasqlclient/
New code should use the new library
Tuesday, December 15, 2020 3:40 PM -
User1312693872 posted
Hi, jagjit saini
You can use 'Package Manager Console' ,and input to install the corresponding version.
Install-Package System.Data.SqlClient -Version 4.6.1.0
https://www.nuget.org/packages/System.Data.SqlClient/
Best Regards,
Jerry Cai
Wednesday, December 16, 2020 5:31 AM