Skip to content

Instantly share code, notes, and snippets.

@isaacabraham
Last active January 20, 2021 20:36
Show Gist options
  • Select an option

  • Save isaacabraham/3545b1e15051f74b4138c78607f75c72 to your computer and use it in GitHub Desktop.

Select an option

Save isaacabraham/3545b1e15051f74b4138c78607f75c72 to your computer and use it in GitHub Desktop.
Working with SQL is once again fun in F# scripts.
#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