Skip to content

ExecuteNonQuery requires an open and available connection #306

@rkosafo

Description

@rkosafo

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions