Home

Error attempting to dump second ExecuteQueryDynamic statement to DataGrid

Simple example using NorthWind database to illustrate error.
this.ExecuteQueryDynamic("select * from Customers").Dump("Customers", true);
this.ExecuteQueryDynamic("select * from Suppliers").Dump("Suppliers", true);
The first line works fine, but the second throws an exception
InvalidOperationException: There is already an open DataReader associated with this Command which must be closed first.
Works find if dumping to rich text/html and also works if using this.ExecuteQuery.

This is using v5.28.05.

Comments

  • Due to the presence of a message loop (which is required for data grids), what ends up happening is something like this:
    var query1 = this.ExecuteQueryDynamic ("select * from customers");
    var query2 = this.ExecuteQueryDynamic ("select * from suppliers");
    query1.Dump();
    query2.Dump();
    You can work around it by adding .ToArray() to your query. I guess I could build this into the ExecuteQueryDynamic method.
Sign In or Register to comment.