•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 456,554 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,485 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 2860 | Replies: 6
![]() |
•
•
Join Date: Aug 2007
Location: Somewhere between heaven and hell
Posts: 112
Reputation:
Rep Power: 2
Solved Threads: 8
Dear all .Netters,
In my report, I have 3 parametes(Par1,Par2,Par3)
In this case, I only want to give parameter only for Par1,Par2.
I set Par3 as interal and hidden parameter.
In my webform, I write these code :
ReportViewer1.ProcessingMode = ProcessingMode.Local
Dim rep As LocalReport = ReportViewer1.LocalReport
rep.ReportPath = "RptProductPhoto.rdlc"
Dim I As Byte
Dim GetParameter As String = ""
Dim TotalParameter As Byte
TotalParameter = rep.GetParameters.Count
Dim par(TotalParameter - 1) As Microsoft.Reporting.WebForms.ReportParameter
For I = 0 To rep.GetParameters.Count - 1
GetParameter = rep.GetParameters.Item(I).Name
Select Case LCase(GetParameter)
Case "par1"
par(I) = New Microsoft.Reporting.WebForms.ReportParameter(GetParameter, "Par1")
Case "par2"
par(I) = New Microsoft.Reporting.WebForms.ReportParameter(GetParameter, "Par2")
End Select
Next
rep.SetParameters(par)
The program yields an error.
"Value cannot be null." reffering to "rep.SetParameters(par)" line code.
So, what should I do to remove the error ?
Thanks,
Kusno
In my report, I have 3 parametes(Par1,Par2,Par3)
In this case, I only want to give parameter only for Par1,Par2.
I set Par3 as interal and hidden parameter.
In my webform, I write these code :
ReportViewer1.ProcessingMode = ProcessingMode.Local
Dim rep As LocalReport = ReportViewer1.LocalReport
rep.ReportPath = "RptProductPhoto.rdlc"
Dim I As Byte
Dim GetParameter As String = ""
Dim TotalParameter As Byte
TotalParameter = rep.GetParameters.Count
Dim par(TotalParameter - 1) As Microsoft.Reporting.WebForms.ReportParameter
For I = 0 To rep.GetParameters.Count - 1
GetParameter = rep.GetParameters.Item(I).Name
Select Case LCase(GetParameter)
Case "par1"
par(I) = New Microsoft.Reporting.WebForms.ReportParameter(GetParameter, "Par1")
Case "par2"
par(I) = New Microsoft.Reporting.WebForms.ReportParameter(GetParameter, "Par2")
End Select
Next
rep.SetParameters(par)
The program yields an error.
"Value cannot be null." reffering to "rep.SetParameters(par)" line code.
So, what should I do to remove the error ?
Thanks,
Kusno
•
•
Join Date: Aug 2007
Location: Somewhere between heaven and hell
Posts: 112
Reputation:
Rep Power: 2
Solved Threads: 8
•
•
Join Date: Sep 2007
Posts: 1,058
Reputation:
Rep Power: 4
Solved Threads: 61
I am confused by your code.. but let's see.
You set par() equal to the total parameters, so if you have 3 parameters, it will be par(3). Are you trying to make this into an array for reading it later? Cause you are never adding the values to the array.
Try using this to add the values to the array:
This adds the certain parameter to your array of par. I was confused why you had it after the Next command and just (par) and not with a value.. so it makes sense now. Since you never added anything to "par", it returned null. Try that.
You set par() equal to the total parameters, so if you have 3 parameters, it will be par(3). Are you trying to make this into an array for reading it later? Cause you are never adding the values to the array.
Try using this to add the values to the array:
ReportViewer1.ProcessingMode = ProcessingMode.Local Dim rep As LocalReport = ReportViewer1.LocalReport rep.ReportPath = "RptProductPhoto.rdlc" Dim I As Byte Dim GetParameter As String = "" Dim TotalParameter As Byte TotalParameter = rep.GetParameters.Count Dim par(TotalParameter - 1) As Microsoft.Reporting.WebForms.ReportParameter For I = 0 To rep.GetParameters.Count - 1 GetParameter = rep.GetParameters.Item(I).Name Select Case LCase(GetParameter) Case "par1" par(I) = New Microsoft.Reporting.WebForms.ReportParameter(GetParameter, "Par1") Case "par2" par(I) = New Microsoft.Reporting.WebForms.ReportParameter(GetParameter, "Par2") End Select rep.SetParameters(par(I)) Next
•
•
Join Date: Aug 2007
Location: Somewhere between heaven and hell
Posts: 112
Reputation:
Rep Power: 2
Solved Threads: 8
I've tried your code, but this was happened :
Unable to cast object of type 'Microsoft.Reporting.WebForms.ReportParameter' to type 'System.Collections.Generic.IEnumerable`1[Microsoft.Reporting.WebForms.ReportParameter]'.
I don't know why Reporting Services compels all parameters to be filled in, but in my experience when using Crystal Reports, we can pass to certain parameters that we want to.
But unfortunately, Crystal Reports that bundled in VS 2005 still has bug.
Unable to cast object of type 'Microsoft.Reporting.WebForms.ReportParameter' to type 'System.Collections.Generic.IEnumerable`1[Microsoft.Reporting.WebForms.ReportParameter]'.
I don't know why Reporting Services compels all parameters to be filled in, but in my experience when using Crystal Reports, we can pass to certain parameters that we want to.
But unfortunately, Crystal Reports that bundled in VS 2005 still has bug.
•
•
Join Date: Sep 2007
Posts: 1,058
Reputation:
Rep Power: 4
Solved Threads: 61
Two things.. maybe on your first code it requires you to specifiy the visibibility, so replace these lines:
(GetParameter, "Par1", false/true)
(GetParameter, "Par2", false/true)
and make the false/true set to your visibility, false none, true visible.
The other, try this:
(GetParameter, "Par1", false/true)
(GetParameter, "Par2", false/true)
and make the false/true set to your visibility, false none, true visible.
The other, try this:
ReportViewer1.ProcessingMode = ProcessingMode.Local Dim rep As LocalReport = ReportViewer1.LocalReport rep.ReportPath = "RptProductPhoto.rdlc" Dim I As Byte Dim GetParameter As String = "" Dim TotalParameter As Byte TotalParameter = rep.GetParameters.Count Dim paramlist As New Generic.List(Of ReportParameter) For I = 0 To rep.GetParameters.Count - 1 GetParameter = rep.GetParameters.Item(I).Name Select Case LCase(GetParameter) Case "par1" par.Add(New ReportParameter(GetParameter, "Par1")) Case "par2" par.Add(New ReportParameter(GetParameter, "Par2")) End Select Next rep.SetParameters(par)
Last edited by SheSaidImaPregy : Oct 25th, 2007 at 10:44 am.
![]() |
•
•
•
•
•
•
•
•
DaniWeb ASP.NET Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- passing parameters in bat file (Visual Basic 4 / 5 / 6)
- Problem in passing parameters (Visual Basic 4 / 5 / 6)
- Passing parameters to a system call (Perl)
- passing parameters to a page (JavaScript / DHTML / AJAX)
- Passing Variables/Parameters - By Ref/Value? (Computer Science and Software Design)
Other Threads in the ASP.NET Forum
- Previous Thread: crystal reports in asp.net
- Next Thread: Make URLS understandable



Linear Mode