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

Stimulsoft Reports.NET discussion
Post Reply
Chris42
Posts: 27
Joined: Fri Aug 18, 2017 5:50 pm

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

Post 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
Attachments
StimulsoftParamsAndVars.mrt
(3.96 KiB) Downloaded 264 times
StimulsoftParamsAndVars.txt
(1.39 KiB) Downloaded 123 times
StimulsoftParamsAndVars.png
StimulsoftParamsAndVars.png (67.97 KiB) Viewed 2691 times
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

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

Post 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.
Chris42
Posts: 27
Joined: Fri Aug 18, 2017 5:50 pm

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

Post by Chris42 »

Hi Aleksey,

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

Chris
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

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

Post by Alex K. »

Hello

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

Thank you.
Chris42
Posts: 27
Joined: Fri Aug 18, 2017 5:50 pm

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

Post 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
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

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

Post by Alex K. »

Hello,

Thank you for the additional information.

We are working on this issue.

Thank you.
Post Reply