fsprojects / fsprojects/FSharp.Data.SqlClient
ExecuteNonQuery requires an open and available connection
Nobody has claimed this yet.
- Dominant language
- F#
- Stars
- 206
- Forks
- 66
- PR merge metrics
- No merged PRs in 30d
Description
Description
Queries with TempTables failed with the call to .LoadTempTables.
Repro steps
type Q =
SqlCommandProvider<
"select 1 as id", //same error as "select * from #Temp1"
ConnStr,
TempTableDefinitions = "create table #Temp1 (name nvarchar(32) not null)">
let f () =
let cmd = new Q (ConnStr)
cmd.LoadTempTables (Array.empty) //fails here
cmd.Execute () |> List.ofSeq
[<EntryPoint>]
let main argv =
f () |> printfn "%A"
System.Console.ReadLine () |> ignore
0 // return an integer exit code
Expected behavior
Expected query to execute and return something
Actual behavior
System.InvalidOperationException: 'ExecuteNonQuery requires an open and available Connection. The connection's current state is closed.'
Known workarounds
Not sure. Similar code with 1.8.5 worked in a different project so not sure what is different here.
Related information
- Operating system: windows 10
- Branch: ?
- Database versions and sample databases being used: 14.0.1000.169
- .NET Runtime, CoreCLR or Mono Version: .NET 4.7.1.
- Editing Tools (e.g. Visual Studio Version): VS 2017 15.8.0 Preview 2.0
- Lins to F# RFCs or entries on http://fslang.uservoice.com
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the supplied F# example around SqlCommandProvider, LoadTempTables, and Execute against SQL Server. Trace why LoadTempTables reaches ExecuteNonQuery with a closed connection, then verify that the sample query executes and returns its result without the reported exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- fsharp, sql
- Domain
- database
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100