Comments (5)
@houdelou thanks for the report, could you add "nuget System.Data.SqlClient" to your paket.dependencies file, generate the scripts again, and reference that package before referencing FSharp.Data.SqlClient one?
Here is a very crude script referencing through nuget, but you can replace it with #load statements for the same packagess using paket as well, note that somehow, it is needed to evaluate importing System.Data.SqlClient, so I've put ;;
to force this evaluation:
#r "nuget: System.Data.SqlClient";;
#r "nuget: FSharp.Data.SqlClient"
open System.Data.SqlClient
let [<Literal>] cn = "Server=server;Database=dbname;User Id=user;Password=password;"
type Q = FSharp.Data.SqlCommandProvider< "select * from sys.tables", cn>
let cnx = new SqlConnection(cn)
cnx.Open()
let q = Q(cnx)
let results = q.Execute() |> Seq.toArray
printfn $"hello %A{results}"
Please let me know if this helps.
from fsharp.data.sqlclient.
@smoothdeveloper Thank you for your help. I copied your code into a script file and I still get the same error message. Interesting approach though with the ";;". Are you also using .NET 6 ? I think I could try with other framework versions. .NET 6 is recent so maybe there is not enough dev using it yet ? I'll try to create a new project to see if it might work. Thanks again.
from fsharp.data.sqlclient.
Is it possible that the project references System.Data.SqlClient instead of its successor Microsoft.Data.SqlClient ? Can it be the problem I'm having ?
from fsharp.data.sqlclient.
@houdelou, I'm not reproducing using my sample script in VS 2022 or from dotnet fsi
command line, both works ok.
I'd suggest you first try to make use of a plain System.Data.SqlServer ado.net provider in your environment, to make sure we have a base plate which works, disregarding this library.
Regarding Microsoft.Data.SqlClient, it is not supported in this library for now, but there are discussions: #374 about it.
from fsharp.data.sqlclient.
@smoothdeveloper Ok now it seems to be working with ";;" at the end of the line. I did a couple of tests and finally it worked when I restarted the interpreter. Thanks ! Problem solved
from fsharp.data.sqlclient.
Related Issues (20)
- Dacpac support info HOT 3
- "F# Formatting" link is broken
- Can't build/run from the commandline, but can from Visual Studio 2019 HOT 2
- Question: Creating a provider without an access to DB HOT 3
- SqlEnumProvider breaks VS 2019 HOT 2
- Not platform detection Fable HOT 1
- Build is broken without full VS installation
- Fixed length binary columns in user defined table types fail when constructed HOT 8
- Cannot use User Defined Table Types with the SqlCommandProvider HOT 5
- .NET 6 support HOT 6
- One line summary of the bug HOT 2
- TVP Column Ordering is incorrect as of version 2.1.0
- Cannot use parameter name more than once in a script HOT 3
- Conversion failed when using User Defined Table Types HOT 1
- Any 2023 tricks for running on Windows? HOT 3
- NullReferenceException in SqlConnection.UseLocally HOT 1
- Support for 'Active Directory Interactive' authentication HOT 3
- dotnet SDK projects using FSharp.Core version 7.0.0 breaks at runtime HOT 3
- SQL LIKE operation doesn't recognize variable HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fsharp.data.sqlclient.