How to pass Parameter into SQL base Report

Stimulsoft Reports.Flex discussion
Locked
ssaturn
Posts: 13
Joined: Mon Jun 07, 2010 5:05 am
Location: Malaysia

How to pass Parameter into SQL base Report

Post by ssaturn »

Hi,

I am trying to generate the report by passing parameter from Web Form,

Example, I want to pass @DateStart and @DateEnd parameter into a SQL query..

I using the method,

Me.stiReport1.Item("@DateStart")
Me.stiReport1.Item("@DateEnd")

compilation is no problem, the only problem I face is no result return, and Stimulsoft Report is not generated.

Anything I miss over here?
---

If I set a query without passing any parameter into the SQL, the Stimulsoft Report work fine.

Anyone can help me on this?

Thanks,
Andrew
Posts: 4107
Joined: Fri Jun 09, 2006 3:58 am

How to pass Parameter into SQL base Report

Post by Andrew »

Hello,

Do you use Stimulsoft Reports.Fx for Flex?

Thank you.
ssaturn
Posts: 13
Joined: Mon Jun 07, 2010 5:05 am
Location: Malaysia

How to pass Parameter into SQL base Report

Post by ssaturn »

Hi,

Thanks for the quick reply.

I am using StiWebViewerFx..

Below is my coding
Dim ReportDateStart As DateTime = cDateStart.SelectedDate
Dim ReportDateEnd As DateTime = cDateEnd.SelectedDate
Dim Report As StiReport = New StiReport
Dim applicationDirectory As String = HttpContext.Current.Server.MapPath(String.Empty)
Dim reportFileName As String = applicationDirectory & "\Reports\reportTimeShifts.mrt"
Dim TagID As String = dlistUserName.SelectedItem.Text


Report.Load(reportFileName)

Report.Item("@TagID") = TagID
Report.Item("@DateStart") = ReportDateStart
Report.Item("@DateEnd") = ReportDateEnd
Report.Compile()
Report.Render(True)

Me.StiWebViewerFx1.Report = Report
That the full code of it, but it when come to generating the report, it give a blank..
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

How to pass Parameter into SQL base Report

Post by Jan »

Hello,

Please check following sample project:

www.stimulsoft.com/private/WebSqlParameters.zip

This project use WebViewer but code for WebViewerFx will be same.

Thank you.
ssaturn
Posts: 13
Joined: Mon Jun 07, 2010 5:05 am
Location: Malaysia

How to pass Parameter into SQL base Report

Post by ssaturn »

Hi,

Thanks for the reply, I will give this method a try :). Will let you know is it working or not..
:biggrin:

Andrew
Posts: 4107
Joined: Fri Jun 09, 2006 3:58 am

How to pass Parameter into SQL base Report

Post by Andrew »

Thank you!
ssaturn
Posts: 13
Joined: Mon Jun 07, 2010 5:05 am
Location: Malaysia

How to pass Parameter into SQL base Report

Post by ssaturn »

Hi,

I tried the method
Dim ReportDateStart As DateTime = cDateStart.SelectedDate
Dim ReportDateEnd As DateTime = cDateEnd.SelectedDate
Dim Report As StiReport = New StiReport
Dim applicationDirectory As String = HttpContext.Current.Server.MapPath(String.Empty)
Dim reportFileName As String = applicationDirectory & "\Reports\reportTimeShifts.mrt"
Dim TagID As String = dlistUserName.SelectedItem.Text

Report.Load(reportFileName)
Report.Compile()

Report.CompiledReport.DataSources("reportTimeShift").Parameters("@DateStart").ParameterValue = ReportDateStart
Report.CompiledReport.DataSources("reportTimeShift").Parameters("@DateEnd").ParameterValue = ReportDateEnd

Report.Render()

Me.StiWebViewerFx1.Report = Report
And it still giving me a blank page, as far as I know the loading value stop when it reach around 33%, then the report page turn blank. Event I try just put a title (textblock) in the report, it doesn't turn out as well.

Note: reportTimeShift is the name for the DataSource in MRT file

Any Idea why?

---

Another Error I encounter is when i user webreportviewer I get the error on reportTable is null, and there is no return on offsetWidth. It stop at the debug mode.. If I click on continue, nothing will get generate as well.

reportFrame.width = reportTable.offsetWidth;
reportFrame.height = reportTable.offsetHeight - heightDelta;
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

How to pass Parameter into SQL base Report

Post by Jan »

Hello,

Please attach your report for examination or send it to support@stimulsoft.com.

Thank you.
ssaturn
Posts: 13
Joined: Mon Jun 07, 2010 5:05 am
Location: Malaysia

How to pass Parameter into SQL base Report

Post by ssaturn »

I sent the email :) hope to hear from you all soon
Locked