Results 1 to 3 of 3

Thread: SqlConnection object not recognized

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jan 2004
    Location
    Southern California
    Posts
    5,034

    SqlConnection object not recognized

    Not sure why this is happening. I'm using the correct library "System.Data.SqlClient". Please see below image. If image is to small to see, how can I enlarge it? Thanks!Attachment 188456
    Attached Images Attached Images  
    Blake

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: SqlConnection object not recognized

    What framework are you targeting? I'm guessing it's some version of .NET Core, including .NET 5 or later. When you target .NET Framework, there is generally a reference to System.Data.dll added by default and that contains the System.Data.SqlClient provider. When you target .NET Core, each ADO.NET provider is in its own library and none are referenced by default, so you need to install the appropriate NuGet package. You can use System.Data.SqlClient but it exists basically for backward compatibility. Instead, you should install the Microsoft.Data.SqlClient package, as that's where all the new development is being done. The types and members that you're used to will still be there. You just need a different namespace import.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Jan 2004
    Location
    Southern California
    Posts
    5,034

    Re: SqlConnection object not recognized

    Thank you sir...
    Blake

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width