问题描述
代码如下:PrivateSubButton1_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton1.ClickDimrptDAAsSqlDataAdapterDimDSAsNewDataSetDimrptDSAsReportDataSourceDimSQLCommand="SELECT*FROMAREAWHEREAREA_ID='350582107800'"rptDA=NewSqlDataAdapter(SQLCommand,jsConn)rptDA.Fill(DS,"AREA")rptDS=NewReportDataSource("AERA",DS.Tables("AREA"))ReportViewer1.Reset()ReportViewer1.LocalReport.ReportEmbeddedResource="Report1.rdlc"ReportViewer1.LocalReport.ReportPath="D:我的程序VB2005RDLC编程练习2RDLC编程练习2Report1.rdlc"ReportViewer1.LocalReport.DataSources.Clear()ReportViewer1.LocalReport.DataSources.Add(rptDS)ReportViewer1.LocalReport.Refresh()ReportViewer1.RefreshReport()EndSub提示:尚未为数据源“AREA”提供数据源实例。谁能帮我看下到底错在哪里?
解决方案
解决方案二:
上面那段代码看着很乱,我重新整理了一下。PrivateSubButton1_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton1.ClickDimrptDAAsSqlDataAdapterDimDSAsNewDataSetDimrptDSAsReportDataSourceDimSQLCommand="SELECT*FROMAREAWHEREAREA_ID='350582107800'"rptDA=NewSqlDataAdapter(SQLCommand,jsConn)rptDA.Fill(DS,"AREA")rptDS=NewReportDataSource("AERA",DS.Tables("AREA"))ReportViewer1.Reset()ReportViewer1.LocalReport.ReportEmbeddedResource="Report1.rdlc"ReportViewer1.LocalReport.ReportPath="D:我的程序VB2005RDLC编程练习2RDLC编程练习2Report1.rdlc"ReportViewer1.LocalReport.DataSources.Clear()ReportViewer1.LocalReport.DataSources.Add(rptDS)ReportViewer1.LocalReport.Refresh()ReportViewer1.RefreshReport()EndSub
解决方案三:
自已顶一下,高手帮帮忙。