fsprojects / SQLProvider

A general F# SQL database erasing type provider, supporting LINQ queries, schema exploration, individuals, CRUD operations and much more besides.
https://fsprojects.github.io/SQLProvider
Other
579 stars 146 forks source link

The type 'SqlDataProvider' is not defined #719

Open dmitryrusak opened 3 years ago

dmitryrusak commented 3 years ago

Hi, I tried to create a simplest possible program to test the SQLite connection using the SQLProvider. I use MS Visual Studio 2017, FW 4.7.2, Win10. Here is a code:

#r @"..\packages\SQLProvider.1.2.1\lib\net472\FSharp.Data.SqlProvider.dll"
open FSharp.Data.Sql
let [<Literal>] cs = @"Data Source=..\db\test.db;Version=3"
let [<Literal>] rp = @"..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.113.3\lib\net46"
type sql = SqlDataProvider<
                Common.DatabaseProviderTypes.SQLITE,
                SQLiteLibrary = Common.SQLiteLibrary.SystemDataSQLite,
                ConnectionString = cs,
                ResolutionPath = rp,
                CaseSensitivityChange = Common.CaseSensitivityChange.ORIGINAL>

When running the script (or from ide) i get following error: Script1.fsx(5,12): error FS0039: The type 'SqlDataProvider' is not defined. The line of code (open FSharp.Data.Sql) gives a warning: Referenced assembly "..FSharp.Data.SQLProvider.dll" has assembly level attribute 'Microsoft.FSharp.Core.CompilerServices.TypeProviderAssemblyAttribute' but no public type provider classes were found Please help. whats wrong?

gordonfranke commented 3 years ago

I have the same issue and can't get past the starting gate.

`module Data

open FSharp.Data.Sql

type sql = SqlDataProvider<FSharp.Data.Sql.Common.DatabaseProviderTypes.MSSQLSERVER,"CONNECTION STRING HERE">`

Intellisense underlines SQLDataProvider and says "The type 'SqlDataProvider' is not defined." I assume I'm missing something basic but can't figure it out. If I start with FSharp.Data.Sql and press dot and navigate through the assembly I don't see SqlDataProvider anywhere.

arnesahlberg commented 3 years ago

I also get the same problem, saying "The type 'SqlDataProvider' is not defined."

If I downgrade to 1.1.101, it seems to work, though...

dmitryrusak commented 3 years ago

The problem exists only when using VS2017 (in my case). After an upgrade to VS2019, the problem disappeared, however the Sqlite connection still not working because of missing or broken references in sqlprovider

arnesahlberg commented 3 years ago

Thanks. Upgraded to VS2019 and it now works for me too.