Click here to Skip to main content
15,881,665 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to display specific record in my access database using parameter,
after all the design of my report and my form where the report is going to be displayed, i insert a textbox named txtID and a button named button1



in the button1 action i wrote this

VB
Dim PID As New ReportParameter("PID", txtid.Text)
        Try
            Me.PrisonersTableAdapter.Fill(Me.prisonDataSet.Prisoners)
            ReportViewer1.LocalReport.SetParameters(New ReportParameter() (PID))
            ReportViewer1.RefreshReport()
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try 



i am getting this error

Error 3 Bounds can be specified only for the top-level array when initializing an array of arrays.


any Help Please? thanks you.
Posted
Comments
PIEBALDconsult 19-Sep-15 21:24pm    
Dunno, but I wonder if you have an extra pair of parentheses in
New ReportParameter() (PID)
Engr. S.M. Inuwa 20-Sep-15 5:27am    
Actual that is what i use in my previous project, but i come to this one and found this error
Richard MacCutchan 20-Sep-15 7:47am    
Which line does the error message refer to?
Engr. S.M. Inuwa 20-Sep-15 12:12pm    
Thanks all i got the problem

The meaning of above error message is explained here: Bounds can be specified only for the top-level array when initializing an array of arrays[^]

It's strongly recommended to read about:
How to: Initialize a Jagged Array[^]
How to: Initialize a Multidimensional Array[^]

On the first look, this line can cause error message:
VB
ReportViewer1.LocalReport.SetParameters(New ReportParameter() (PID))


Replace it with:
VB
ReportViewer1.LocalReport.SetParameters(PID)

It should resolve your issue.

For further information, please see: LocalReport.SetParameters Method[^]
 
Share this answer
 
v3
Comments
Engr. S.M. Inuwa 20-Sep-15 12:14pm    
i did that way but having different error from the previous.
the reason of this error was only because of the bracket i used parentheses bracket instead of carly-bracket


VB
ReportViewer1.LocalReport.SetParameters(New ReportParameter() (PID))

it suppose to be
VB
ReportViewer1.LocalReport.SetParameters(New ReportParameter() {PID})


VB
Dim PID As New ReportParameter("PID", txtid.Text)
        Try
            Me.PrisonersTableAdapter.Fill(Me.prisonDataSet.Prisoners)
            ReportViewer1.LocalReport.SetParameters(New ReportParameter() {PID})
            ReportViewer1.RefreshReport()
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try 


Thank you.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900