Page 1 of 1
How to write this sql command?
Posted: Mon Oct 05, 2009 11:55 am
by Maria
Hello,I'm trying to write a sql command like this:
Code: Select all
select * from employee where name Like '% @name %'
That @name is a parameter.
But I don't know How to write this in stimule soft report.
please help me to write that statement.
Thank you.
How to write this sql command?
Posted: Mon Oct 05, 2009 5:12 pm
by Edward
Hi Maria,
Please write the following expression in the SQL Editor window:
select * from employee where name Like @name
And define a parameter:
@name
The parameter value must be as follows:
@name = "%myparametervalue%"
Thank you.
How to write this sql command?
Posted: Tue Oct 06, 2009 1:31 am
by Maria
Hello Edward,
I did the following:
I’m write the expression such as expression you wrote and then I’m define a parameter named: % @name %
Then I do the following in my code:
report.DataSources["Employee"].Parameters["% name %"].ParameterValue = "%" + txtName.Text.ToString() + "%";
but I get the following Error.
Incorrect syntax near '%'.
Must declare the scalar variable "@name".
Statement(s) could not be prepared.
In Line:
Line 22: report.DataSources["Employee"].Parameters["% @name %"].ParameterValue = "%" + txtName.Text.ToString() + "%";
Line 23: StiWebViewer1.Report = report;
Please help me to fix the error.
Thank you.
How to write this sql command?
Posted: Tue Oct 06, 2009 4:36 am
by Edward
Hi Maria,
Excuse me for my typing error and not clear explanation of the required steps.
Everything you did is correct.
Just change the name of the parameter. Right-click in the '% @name %' parameter (it is an incorrect name for the parameter) and change its name as follows:
@name
Then your query must work.
Thank you.
How to write this sql command?
Posted: Wed Oct 07, 2009 1:22 am
by Maria
Hi Edward,
The program Worked.
Thank you very much:biggrin:
How to write this sql command?
Posted: Wed Oct 07, 2009 3:10 am
by Edward
Hi Maria,
You are very welcome

Have a nice day!
Thank you.