Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

171
Views
¿Cómo conectarse a MS SQL Server con F # con SQLProvider?

Estoy tratando de usar SQLProvider para MS SQL Server con F# , pero parece que no es posible con la configuración recomendada.

Vea mi módulo a continuación:

 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>

Mi principal problema es que después de agregar este código recibo este mensaje/advertencia en intellisense

El proveedor de tipos 'FSharp.Data.Sql.SqlTypeProvider' informó un error: System.Data.SqlClient no es compatible con esta plataforma. F# Compiler(3033)

y un error de compilación al intentar compilar:

 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

¿Hay algo que estoy haciendo mal, o realmente no es posible usar la configuración predeterminada junto con los últimos .NET y F # y necesito enviar un problema de git? Todas las ideas y críticas son bienvenidas, ¡gracias!

En uso en el momento de la publicación:

  • .NET 6
  • Código VS (1.62.2)
  • Ionuro (v5.9.0)
  • SQLProvider Versión 1.2.10
  • System.Data.SqlClient Versión 4.8.3
over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Ejecutar desde la línea de comando: dotnet add package microsoft.data.sqlclient

luego cambie Common.DatabaseProviderTypes.MSSQLSERVER a Common.DatabaseProviderTypes.MSSQLSERVER_DYNAMIC

over 4 years ago · Santiago Trujillo Report

0

Para resolver este problema, abrí el proyecto en Visual Studio (v17 2022) e hice lo siguiente:

  • dependencias eliminadas
  • agregado nuevamente en SQLProvider y System.Data.SqlClient (v4.8.3)
  • Borró las carpetas bin y obj

Después de hacer lo anterior, pude ejecutar la aplicación y obtener una conexión a la base de datos seguida de una simple consulta de selección que devolvió los datos esperados.

No estoy seguro de por qué, pero Ionide siempre da los temidos garabatos rojos, incluso cuando las cosas funcionan bien.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!