Question concerning using a variable in a SQL query.

Stimulsoft Reports.WEB discussion
Post Reply
basisclay
Posts: 2
Joined: Thu Apr 25, 2024 8:23 am

Question concerning using a variable in a SQL query.

Post by basisclay »

Hi everyone. I recently found the ability to define a variable and declare that it may be used as a SQL parameter. My original query looked like this: SELECT * FROM customers. WHERE customerID="@custID"

I also added a parameter named @custID of type int.

I eliminated the parameter and then added a variable named @custID with the checkbox "Allow using as SQL parameter". The report fails to run in the designer and crashes due to the "@" symbol.
How do you utilize a variable in your query?
JohnW
Posts: 104
Joined: Mon Nov 20, 2017 8:29 pm

Re: Question concerning using a variable in a SQL query.

Post by JohnW »

In the report data query you still need the sql parameter. You then assign the parameter value in the parameter Expression property to the variable you created.
basisclay
Posts: 2
Joined: Thu Apr 25, 2024 8:23 am

Re: Question concerning using a variable in a SQL query.

Post by basisclay »

Thanks for your supports, JohnW.
Post Reply