Skip to content

Lesson 32 SqlCommandProvider #55

@StuartSchady

Description

@StuartSchady

I have tried using the
#r "nuget: FSharp.Data.SqlClient, 2.1.2" via F# interactive, as well as referencing the .dll after I have built the project in both .Net and .netframework.

Everytime I try to execute the line of code:

#r "nuget: FSharp.Data.SqlClient, 2.1.2"

open System
open FSharp.Data


let [<Literal>] Conn = 
    @"Server=(localdb)\MSSQLLocalDb;Database=AdventureWorksLT;Integrated Security=SSPI"
type GetCustomers = SqlCommandProvider<"SELECT * FROM SalesLT.Customer", Conn>

I get this error:

error FS3021: Unexpected exception from provided type 'FSharp.Data.SqlCommandProvider,CommandText="SELECT * FROM SalesLT.Customer",ConnectionStringOrName="Server=(localdb)\\MSSQLLocalDb;Database=AdventureWorksLT;Integrated Security=SSPI"' member 'GetMethods': The type provider 'FSharp.Data.SqlCommandProvider' reported an error: The design-time type 'System.Data.SqlClient.SqlConnection' utilized by a type provider was not found in the target reference assembly set '[tgt assembly FSharp.Data.SqlClient, Version=1.0.0.0, Culture=neutral;
....
]'. You may be referencing a profile which contains fewer types than those needed by the type provider you are using.

If anyone knows how to solve this please let me know. Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions