I am trying to execute an IRetrievalQuery using the execute()
method but I am getting the error "No connection is present. Cannot execute command." The documentation tells that I need to open a connection but I am not sure how. What should I do to execute my query ? Any ideas ? I am using LLBLGen version 2.6.
Code:
IRetrievalQuery query = RetrievalProcedures.GetLlmBudgetGetDepTotalCancelledCallAsQuery(month, BudgetUtils.CurrentTerm(), department);
DataTable data = new DataTable();
data.Load(query.Execute(CommandBehavior.CloseConnection)); // execute fails
I asked it on LLBLGEN form and this is the answer I got. I basically needed something like below:
The
IDataReader
instance in the example can also be used to load the data into a DataTable using itsLoad
method.