SqlConnection not working in LinqPad 7

I have recently upgraded to LinqPad 7 and am finding that some existing scripts no longer work. For example, I have a script with an SqlConnection for which I am getting the error "BC30002 Type 'SqlConnection' is not defined" in LinqPad 7. The script continues to run as expected in LinqPad 5. The offending line is "Using conn As New SqlConnection(ConnString)".


  • You need to add System.Data.SqlClient to your F4 NameSpace Imports as this is now longer added by default.

  • edited May 5

    You will also need to either check the "Reference LINQ-to-SQL assemblies" option in the Query Properties dialog, or add a NuGet reference to the System.Data.SqlClient (or Microsoft.Data.SqlClient) package, as the SQL client is no longer a standard part of the .NET libraries.

  • rahrah
    edited May 5

    Great stuff. Thanks gentlemen. Both of those things together did the trick - ie. Adding System.Data.SqlClient and checking "Reference LINQ-to-SQL assemblies". It did not work with either of those on its own without the other. Much appreciated. :)

Sign In or Register to comment.