尚未为数据源trailDataset_voter提供数据源实例 [英] a data source instance has not been supplied for the data source trailDataset_voter

查看:112
本文介绍了尚未为数据源trailDataset_voter提供数据源实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的代码



使用Me.ReportViewer1.LocalReport 

'报告路径
.ReportPath = Application.StartupPath& \..\..\Report1.rdlc
.DataSources.Clear(


结束'----------- -----------------------------------------
'主要的数据源报告(价格> 200)
'------------------------------------- ---------------
Dim SQL As String =SELECT Voter.SrNo,Voter.YadiNo,Voter.FullName,Voter.Gender,Voter.Age,Voter.HouseNo, Voter.Address,Voter.CardNo FROM Voter WHERE yadino = 1
使用da作为新的OleDbDataAdapter(SQL,My.Settings.trialConnectionString)
da.SelectCommand.Parameters.Add(@ yadino,OleDbType .Integer).Value = 200

使用ds作为新数据集
da.Fill(ds,voter)

'你必须使用相同的名称在报告中定义
'数据源定义
Dim rptDataSource作为新的ReportDataSou rce(dsReport_products,ds.Tables(voter))
Me.ReportViewer1.LocalReport.DataSources.Add(rptDataSource)

结束使用

结束使用


ReportViewer1.RefreshReport()





i运行时出现错误

a数据源实例尚未提供数据源trailDataset_voter



提前感谢。

解决方案

  Me  .ReportViewer3.Reset()

.ReportViewer3.LocalReport.ReportPath = ;
Dim rds 作为 ReportDataSource( ,ds1.Tables( ))
Me .ReportViewer3.LocalReport.DataSources.Add(rds)



在reset()之后提到报告路径。当你在外面写它时它无法识别路径...

希望它会工作..


this is my code

With Me.ReportViewer1.LocalReport

                ' Report path
                .ReportPath = Application.StartupPath & "\..\..\Report1.rdlc"
                .DataSources.Clear(
            End With

            ' ----------------------------------------------------
            ' Datasource for the main report (where price > 200)
            ' ----------------------------------------------------
            Dim SQL As String = "SELECT Voter.SrNo, Voter.YadiNo, Voter.FullName, Voter.Gender, Voter.Age, Voter.HouseNo, Voter.Address, Voter.CardNo FROM Voter WHERE yadino=1"
            Using da As New OleDbDataAdapter(SQL, My.Settings.trialConnectionString)
                da.SelectCommand.Parameters.Add("@yadino", OleDbType.Integer).Value = 200

                Using ds As New DataSet
                    da.Fill(ds, "voter")

                    ' You must use the same name as defined in the report 
                    ' Data Source Definition
                    Dim rptDataSource As New ReportDataSource("dsReport_products", ds.Tables("voter"))
                    Me.ReportViewer1.LocalReport.DataSources.Add(rptDataSource)

                End Using

            End Using

           
            ReportViewer1.RefreshReport()



i am getting the error when run
a data source instance has not been supplied for the data source trailDataset_voter

thanks in advance.

解决方案

Me.ReportViewer3.Reset()

     Me.ReportViewer3.LocalReport.ReportPath = "";
     Dim rds As New ReportDataSource("", ds1.Tables(""))
     Me.ReportViewer3.LocalReport.DataSources.Add(rds)


mention the report path just after reset().as you wrote it outside so it's unable to identify the path...
Hope it will work..


这篇关于尚未为数据源trailDataset_voter提供数据源实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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