Run Sql Query in band's events
-
- Posts: 105
- Joined: Thu Aug 17, 2017 12:07 pm
Run Sql Query in band's events
Dear Stimulsoft team,
I would like to run a sql statement in the event of StiText. When Text is being set to StiText in DataBand, i would like to grab the cell of that particular row AND by that value to run SQL STATEMENT. LIKE THIS:
JAMES (Sql Query -> SELECT USER_CODE FROM USERS WHERE USER NAME = 'JAMES' )
BILL (Sql Query -> SELECT USER_CODE FROM USERS WHERE USER NAME = 'BILL' )
SUSY (Sql Query -> SELECT USER_CODE FROM USERS WHERE USER NAME = 'SUSY' )
Also set to back to StiText the result of Sql Query.
HOW CAN I DO THAT?
Regards,
Iskandar A
I would like to run a sql statement in the event of StiText. When Text is being set to StiText in DataBand, i would like to grab the cell of that particular row AND by that value to run SQL STATEMENT. LIKE THIS:
JAMES (Sql Query -> SELECT USER_CODE FROM USERS WHERE USER NAME = 'JAMES' )
BILL (Sql Query -> SELECT USER_CODE FROM USERS WHERE USER NAME = 'BILL' )
SUSY (Sql Query -> SELECT USER_CODE FROM USERS WHERE USER NAME = 'SUSY' )
Also set to back to StiText the result of Sql Query.
HOW CAN I DO THAT?
Regards,
Iskandar A
-
- Posts: 6247
- Joined: Tue Mar 20, 2018 5:34 am
Re: Run Sql Query in band's events
Hello,
You can use a parameter in the query:
SELECT USER_CODE FROM USERS WHERE USER NAME = @Param1
set param in the BeforePrint event and use Connect() method for data source.
Thank you.
You can use a parameter in the query:
SELECT USER_CODE FROM USERS WHERE USER NAME = @Param1
set param in the BeforePrint event and use Connect() method for data source.
Thank you.
-
- Posts: 105
- Joined: Thu Aug 17, 2017 12:07 pm
Re: Run Sql Query in band's events
Hello,
Can you please provide a row sample in .mrt file . Or more detailedly explain with code samples
It is difficult to understand the approach from above
Regards,
Iskandar A.
Can you please provide a row sample in .mrt file . Or more detailedly explain with code samples
It is difficult to understand the approach from above
Regards,
Iskandar A.
-
- Posts: 105
- Joined: Thu Aug 17, 2017 12:07 pm
Re: Run Sql Query in band's events
what is Param1 and should it be defined or it is already defined? will your approach will work for each row's cell ?
Regards,
Iskandar A
Regards,
Iskandar A
-
- Posts: 6247
- Joined: Tue Mar 20, 2018 5:34 am
Re: Run Sql Query in band's events
Hello,
Please check the sample report in the attachment.
Thank you.
Please check the sample report in the attachment.
Thank you.
- Attachments
-
- ReportSample.mrt
- (9.95 KiB) Downloaded 148 times
-
- Posts: 105
- Joined: Thu Aug 17, 2017 12:07 pm
Re: Run Sql Query in band's events
Thanks it worked
Regards,
Iskandar A
Regards,
Iskandar A
-
- Posts: 6247
- Joined: Tue Mar 20, 2018 5:34 am
Re: Run Sql Query in band's events
You are welcome.