Page 1 of 1

Designer: MS SQL Query with mix of Parameters and Vars fails

Posted: Tue Sep 26, 2017 4:40 pm
by Chris42
Hi,

I have a basic SQL Server query, created on a new report. If the query uses both a parameter (set to a fixed value) and references a Variable (again set to a fixed value) then I get an exception when trying to run query in the editor dialog or attempting to run the whole report:
SqlCommand.Prepare method requires all parameters to have an explicitly set type.
The Parameter and Variable have the type set.

Switching to use just a Parameter (by removing the indicated line from the Products query) or removing the explicit Parameter (and the corresponding clause in the query) then it runs OK.

Is this a bug?

My current work-around is currently to use explicit Parameters (using just Variables would also work).

Thanks,
Chris

Re: Designer: MS SQL Query with mix of Parameters and Vars f

Posted: Tue Sep 26, 2017 10:46 pm
by Alex K.
Hello,

Thank you for the bug report. We need some time to fix the issue.
At the current moment, you can set the following option:
StiOptions.Engine.AllowPrepareSqlQueries = false;

Thank you.

Re: Designer: MS SQL Query with mix of Parameters and Vars f

Posted: Tue Sep 26, 2017 10:50 pm
by Chris42
Hi Aleksey,

Thanks for the quick reply. I'll try the AllowPrepareSqlQueries option.

Chris

Re: Designer: MS SQL Query with mix of Parameters and Vars f

Posted: Wed Sep 27, 2017 9:37 am
by Alex K.
Hello

Ok.
Please let us know if you need any additional help.

Thank you.

Re: Designer: MS SQL Query with mix of Parameters and Vars f

Posted: Wed Sep 27, 2017 11:08 am
by Chris42
Aleksey,

Thanks, should be OK for now.

I tried setting AllowPrepareSqlQueries = false and this does allow the report to run :-)

Just for info (may be unrelated): I can 'Run' and 'View Query' in the Edit Data Source dialog (seeing results returned as expected). I'm not able to Retrieve Columns - it just silently fails. Removing the indicated line referencing the @var1 it then works.

Chris

Re: Designer: MS SQL Query with mix of Parameters and Vars f

Posted: Wed Sep 27, 2017 2:08 pm
by Alex K.
Hello,

Thank you for the additional information.

We are working on this issue.

Thank you.