SQLProvider icon indicating copy to clipboard operation
SQLProvider copied to clipboard

The type 'SqlDataProvider' is not defined

Open dmitryrusak opened this issue 4 years ago • 4 comments
trafficstars

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?

dmitryrusak avatar Mar 18 '21 13:03 dmitryrusak

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.

gordonfranke avatar Apr 26 '21 19:04 gordonfranke

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...

arnesahlberg avatar Jun 28 '21 08:06 arnesahlberg

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

dmitryrusak avatar Jun 28 '21 09:06 dmitryrusak

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

arnesahlberg avatar Jun 28 '21 11:06 arnesahlberg