Error #2032 when trying to use SQL parameter

Stimulsoft Reports.WEB discussion
Post Reply
Craig
Posts: 29
Joined: Sat May 10, 2014 4:53 pm

Error #2032 when trying to use SQL parameter

Post by Craig »

I am trying to use a filter at the data source level. I created a query like: select * from customers where CustomerName = @param1. Then created a parameter called @param1 of type varchar.
When I preview, I get an error #2032 with server message is empty. I am using version 2014.1.1900.

Is this the right way to use a SQL parameter?
Last edited by Craig on Mon May 12, 2014 4:33 pm, edited 1 time in total.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Error #2932 when trying to use SQL parameter

Post by Alex K. »

Hello,

Please try to set the default value for parameter.
Also you can try to use the variable instead a parameter:
select * from customers where CustomerName = {Variable1}

Thank you.
Craig
Posts: 29
Joined: Sat May 10, 2014 4:53 pm

Re: Error #2032 when trying to use SQL parameter

Post by Craig »

When I use your format I get an error message : Incorrect syntax near '}'. Is there documentation or video which shows how to use a parameter in the the SQL query, automatically show a parameter panel in a web page when the report renders and the user supplies a value for the variable. I am looking for a way to supply the value without writing code. Assume end user doesn't know how to code but still knows how to write SQL queries with parameters.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Error #2032 when trying to use SQL parameter

Post by Alex K. »

Hello,

Please see the following video "Using SQL Parameters in Web":
http://www.stimulsoft.com/en/videos?tag ... &type=list

Thank you.
Craig
Posts: 29
Joined: Sat May 10, 2014 4:53 pm

Re: Error #2032 when trying to use SQL parameter

Post by Craig »

This video is not what I am looking for. I want to use a parameter in the where clause. Not parameter to pass a value to stored procedure. You posted a way to use {Variable1} but that gave me an error 'The name 'Variable1' does not exist in the current context'. I also do not want to write c# code to pass the parameter. Is there a way to define a parameter/variable in SQL and when the report renders, a parameter panel shows up (no coding required). I am still confused between how to use a variable vs parameter and how to define a variable/parameter and how to add a parameter/variable under paramaters option and how to associate a SQL parameter/variable with a report parameter/variable.

The idea is for the report to display an automatic parameter panel where the user enters a value for every parameter defined in SQL.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Error #2032 when trying to use SQL parameter

Post by HighAley »

Hello, Craig.

You should add the Variable1 in designer to avoid the error. This variable should has Request From User option set to True. And you could use this variable in the query.
You could get more information from the Dynamic SQL queries article on our Blog.

Thank you.
Post Reply