Last active
January 20, 2021 20:36
-
-
Save isaacabraham/3545b1e15051f74b4138c78607f75c72 to your computer and use it in GitHub Desktop.
Working with SQL is once again fun in F# scripts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #r "nuget:microsoft.data.sqlclient" | |
| open Microsoft.Data.SqlClient | |
| let conn = new SqlConnection @"Server=(localdb)\ProjectsV13;Database=SampleDb;Integrated Security=True" | |
| conn.Open() | |
| #r "nuget:Dapper" | |
| open Dapper | |
| let anonRec = conn.Query<{| Id : int; Test : string |}> "SELECT Id, Test FROM dbo.[Table]" | |
| let tupled = conn.Query<struct (int * string)> "SELECT Id, Test FROM dbo.[Table]" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment