Best way to access SQL server database?

I’m referring to the official f# page and there are numerous options laid out. Which one do you think is the best way to go?

I’m trying out all of them and figuring out the most suitable way for me, but I would appreciate it if you share any additional information.

I just want to access the database and show the data on the screen. I don’t want anything fancy like entity framework or LINQ. But if you think using those things have significant advantages over writing my own models, I’m ready to change my mind.

FSharp.Data.SqlClient - Use SQL to specify your queries, explore Stored Procedures, User Defined Types and Functions with IntelliSense right in your F# code. Requries SQL Server 2012+ or SQL Azure.
FSharp.Data.SQLProvider - A general SQL database type provider, supporting LINQ queries, schema exploration, individuals and much more besides. Requires SQL Server, SQLite, PostgreSQL, Oracle, MySQL or Microsoft Access.
SqlDataConnection Type Provider - A type provider for accessing SQL using F# 3.0 LINQ queries. Requires Microsoft SQL Server.
SqlEntityConnection Type Provider - A type provider for accessing SQL using F# 3.0 LINQ queries and Entity Framework. Works with a broad range of databases.
ADO .NET - A set of .NET classes exposing data access services to the .NET programmer. Works with a very broad range of databases.
Rezoom.SQL - A library that statically typechecks a common SQL dialect and translates it to various RDBMS backends.

Maybe this is lib is interesting for you too?

2 Likes

For the simple use case you describe, I would think a type provider should work well. So either of the first two items on your list. The only caveat would be that type providers used with .NET Core projects require some special configuration that can be troublesome to learn and keep working. But if you’re developing a .NET Framework project, then no concerns.

If for some reason you decide not to use a type provider, then I’d suggest you consider Dapper.

1 Like

And here is a very basic “getting started” example of using Dapper in F#: https://github.com/ScottHutchinson/dapper-sample

1 Like

Okay great! Thanks. I’ll try this out.