报告参数有问题 [英] Problem with report parameter

查看:115
本文介绍了报告参数有问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在视觉基本的reportviewer中传递参数.我在网上用C#获得了此代码,然后将其翻译为VB.Net.运行时出现错误.谁能告诉我为什么会这样以及解决方案吗?

I try to pass parameter in my visual basic reportviewer. I got this code in C# around the web then I translated it into VB.Net. I''ve got errors when I run it. Can anybody tell me why this happens and the solution??

Private Sub ReportViewerManual_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
    'TODO: This line of code loads data into the 'dbtutorialDataSet.tbltutorial' table. You can move, or remove it, as needed.
    Me.tbltutorialTableAdapter.Fill(Me.dbtutorialDataSet.tbltutorial)
    Me.ReportViewer1.RefreshReport

    Dim AdapterKu As dbtutorialDataSetTableAdapters.tbltutorialTableAdapter = New dbtutorialDataSetTableAdapters.tbltutorialTableAdapter
    Dim TableKu As dbtutorialDataSet.tbltutorialDataTable = New dbtutorialDataSet.tbltutorialDataTable
    AdapterKu.FillBy(TableKu,"7")
    Dim myDataSource As ReportDataSource = new ReportDataSource("Dataset1",(DataTable)TableKu)'-->Here's the error
    Me.ReportViewer1.LocalReport.DataSources.Clear
    Me.ReportViewer1.LocalReport.DataSources.Add(mydatasource)
    Me.ReportViewer1.LocalReport.Refresh
End Sub

推荐答案

我不确定该语句中的(Datatable)位是什么:
I''m not sure what the (Datatable) bit is for in that statement:
Dim myDataSource As ReportDataSource = new ReportDataSource("Dataset1",(DataTable)TableKu)'-->Here's the error


如果您改用它,它会起作用吗?


does it work if you use this instead?

Dim myDataSource As ReportDataSource = new ReportDataSource("Dataset1",TableKu)



如果不起作用,请此处 [ ^ ]是MSDN ReportDataSource构造函数的链接.并且此处 [



If that doesn''t work, here[^] is the MSDN Link for the ReportDataSource Constructor. And here[^] is a walk-through on printing a report that might help.


这篇关于报告参数有问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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