Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

172
Vistas
How to connect to MS SQL Server with F# with SQLProvider?

I'm trying to use the SQLProvider for MS SQL Server with F#, but it appears that it's not possible with the recommended setup.

See my module below:

namespace MyApp

open FSharp.Data.Sql

module Database =

    [<Literal>]
    let dbVendor = Common.DatabaseProviderTypes.MSSQLSERVER


    [<Literal>]
    let connString =
        "Data Source=localhost;Database=MyDatabase;User Id=user;Password='my-password-here'"

    [<Literal>]
    let indivAmount = 1000

    [<Literal>]
    let useOptTypes = true

    type sql = SqlDataProvider<dbVendor, connString, IndividualsAmount=indivAmount, UseOptionTypes=useOptTypes>

My main problem is that after adding in this code I get this message/warning in intellisense

The type provider 'FSharp.Data.Sql.SqlTypeProvider' reported an error: System.Data.SqlClient is not supported on this platform.F# Compiler(3033)

and a build error when attempting to compile:

Copyright (C) Microsoft Corporation. All rights reserved.

  Determining projects to restore...
  All projects are up-to-date for restore.
C:\Development\F#\MyApp\DataTypes.fs(21,16): error FS3033: The type provider 'FSharp.Data.Sql.SqlTypeProvider' reported an error: System.Data.SqlClient is not supported on this platform. [C:\Development\F#\MyApp\MyApp.fsproj]
C:\Development\F#\MyApp\DataTypes.fs(21,16): error FS3033: The type provider 'FSharp.Data.Sql.SqlTypeProvider' reported an error: System.Data.SqlClient is not supported on this platform. [C:\Development\F#\MyApp\MyApp.fsproj]

Build FAILED.

C:\Development\F#\MyApp\DataTypes.fs(21,16): error FS3033: The type provider 'FSharp.Data.Sql.SqlTypeProvider' reported an error: System.Data.SqlClient is not supported on this platform. [C:\Development\F#\MyApp\MyApp.fsproj]
C:\Development\F#\MyApp\DataTypes.fs(21,16): error FS3033: The type provider 'FSharp.Data.Sql.SqlTypeProvider' reported an error: System.Data.SqlClient is not supported on this platform. [C:\Development\F#\MyApp\MyApp.fsproj]
    0 Warning(s)
    2 Error(s)

Time Elapsed 00:00:06.21

Is there something that I'm doing wrong, or is this really just not possible to use the default setup along with latest .NET and F# and I need to submit a git issue? Any insights and critiques welcomed, thanks!

In use at the time of posting:

  • .NET 6
  • VS Code (1.62.2)
  • Ionide (v5.9.0)
  • SQLProvider Version 1.2.10
  • System.Data.SqlClient Version 4.8.3
over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

Run from command line: dotnet add package microsoft.data.sqlclient

then change Common.DatabaseProviderTypes.MSSQLSERVER to Common.DatabaseProviderTypes.MSSQLSERVER_DYNAMIC

over 4 years ago · Santiago Trujillo Denunciar

0

To resolve this issue, I opened the project within Visual Studio (v17 2022) and did the following:

  • removed dependencies
  • added back in SQLProvider and System.Data.SqlClient (v4.8.3)
  • cleared out bin and obj folders

After doing the above I was able to run the application and get a connection to the database followed by a simple select query that returned expected data.

Not sure why, but Ionide always gives the dreaded red squigglies even when things build just fine.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda