Skip to content

Instantly share code, notes, and snippets.

@DominicFinn
Created September 17, 2015 14:52
Show Gist options
  • Save DominicFinn/899dcb40ec8a085ce187 to your computer and use it in GitHub Desktop.
Save DominicFinn/899dcb40ec8a085ce187 to your computer and use it in GitHub Desktop.
ADO.NET command timeout
open System.Data
open System.Data.SqlClient
let cn = new SqlConnection("Data Source=;Initial Catalog=;Persist Security Info=True;User ID=;Password=")
cn.Open()
let command = new SqlCommand("WAITFOR DELAY '00:00:04';select * from sys.tables", cn)
command.CommandTimeout <- 1 // will break
command.ExecuteNonQuery() |> ignore
cn.Close()
printfn "done"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment