使用参数在VB2008中显示特定记录 [英] Display specific record in VB2008 using parameter

查看:72
本文介绍了使用参数在VB2008中显示特定记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的访问数据库中使用参数显示特定记录,

在我的报告的所有设计和我将要显示报告的表单之后,我插入一个名为txtID的文本框和一个名为button1的按钮






按钮1动作
我写的这个



  Dim  PID  As   ReportParameter(  PID,txtid.Text )
尝试
.PrisonersTableAdapter.Fill( Me .prisonDataSet.Prisoners)
ReportViewer1.LocalReport.SetParameters( New ReportParameter()(PID))
ReportViewer1.RefreshReport()
Catch ex As 异常
MessageBox.Show(ex.Message)
结束 尝试







i我收到此错误



错误3初始化阵列数组时,只能为顶级数组指定界限。





任何帮助请?谢谢。

解决方案

上面的错误信息的含义在这里解释:初始化数组数组时,只能为顶级数组指定边界 [ ^ ]



强烈建议阅读:

如何:初始化锯齿状阵列 [ ^ ]

如何:初始化多维数组 [ ^ ]



第一眼看,此行可能会导致错误消息:

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





替换为:

 ReportViewer1.LocalReport.SetParameters(PID)



它应该可以解决您的问题。



如需了解更多信息,请请参阅: LocalReport.SetParameters方法 [ ^ ]


这个错误的原因只是因为括号我使用括号括号而不是carly-bracket





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



它假设是

 R eportViewer1.LocalReport.SetParameters( New  ReportParameter(){PID})





  Dim  PID  As   ReportParameter(  PID,txtid.Text)
尝试
.PrisonersTableAdapter.Fill( Me .prisonDataSet.Prisoners)
ReportViewer1.LocalReport.SetParameters( New ReportParameter(){PID})
ReportViewer1.RefreshReport()
Catch ex As 异常
MessageBox.Show(ex.Message)
< span class =code-keyword>结束 尝试





谢谢你


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

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.

解决方案

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:

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



Replace it with:

ReportViewer1.LocalReport.SetParameters(PID)


It should resolve your issue.

For further information, please see: LocalReport.SetParameters Method[^]


the reason of this error was only because of the bracket i used parentheses bracket instead of carly-bracket


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


it suppose to be

ReportViewer1.LocalReport.SetParameters(New ReportParameter() {PID})



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.


这篇关于使用参数在VB2008中显示特定记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆