Hi all.
I have a Application developed on VB2005 with the reports (processed local) from Microsoft Reporting Services 2005.
I would like to know how can i use the value of a variable to be displayed on a textbox on my report.
Thanks for the help.
Best regards.
dp
Are you asking how to pass a variable from your VB2005 application to the report?
Just want to make sure I understand the question.
|||Yes that's it.
Imagine that on the VB code i have.
Dim varA as integer = 123
What i want is to use the value of varA without writing that value on the database.
Best regards.
dp
|||This is basically what you're looking for:
Dim varA As Integer = 123
Dim param As New Microsoft.Reporting.WebForms.ReportParameter
Dim paramArr(0) As Microsoft.Reporting.WebForms.ReportParameter
param = New Microsoft.Reporting.Webforms.ReportParameter("MyReportParameter", varA)
paramArr(0) = param
ReportViewer1.ServerReport.SetParameters(paramArr)
In your report, you will need to allow it to accept one parameter (in this case I have named it MyReportParameter).
Hope this helps.
|||Hi.
On the Report (Report Parameters) I've filled in Name: MyReportParameter, Data Type: String, Prompt: MyReportParameter. Do i have to put anything on Label and Value?
On the textbox (that i have on the report) i've placed =Parameters!MyReportParameter.Value
When i try to run the code i've get "The source of the report definition has not been specified" on "ReportViewer1.ServerReport.SetParameters(paramArr)"
Any idea?
Best regards.
dp
|||hey Greg..
i'm using codes similar to the one u showed but i'm getting an error that says "The report parameter 'paramSiteCode' is read-only and cannot be modified. (rsReadOnlyReportParameter)".
what am I doing wrong here? I do have a parameter with the name 'paramSiteCode' inside my dataset view.. and it is a report parameters.. however.. things are not working out for me..
here is my codes
Code Snippet
Dim par(0) As Microsoft.Reporting.WebForms.ReportParameter
par(0) = New Microsoft.Reporting.WebForms.ReportParameter("paramSiteCode"
, TextBox1.Text.ToString)
ReportViewer1.ServerReport.SetParameters(par)
ReportViewer1.ServerReport.Refresh()
|||You will have to set the report server path and report name details before running the report: you may have to do something like this in the code:
ReportViewer1.ServerReport.ReportServerUrl = "http://servername/reportserver"
ReportViewer1.ServerReport.ReportPath = "/Reports/Report1"
here, replace servername with the name of your server where you have deployed the report. and replace "Reports" with the name of the folder on report server where you have deployed your report and replace "Report1" with the name of your report.
Shyam
|||abn,
I have replied to your issue in another thread of yours. You just have to uncheck the "Internal" option of your parameter.
Shyam
No comments:
Post a Comment