本文介绍了尚未为数据源“DS_Build_DataTable1”提供数据源实例。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 大家好,我正在使用visual stdio2005 C#。 i 想要使用 reportviewer控件加载 LocalReport控件,报告依赖于存储过程但它给出错误 尚未为数据源提供数据源实例"DS_Build_DataTable1"。 这是我的代码。请帮帮我,告诉我这里有什么问题。hi all, i am using visual stdio2005 C#. i want to load LocalReport control using reportviewer control,the report depend on a stored procedure but it gives the errorA data source instance has not been supplied for the data source "DS_Build_DataTable1".This is my code. please help me and tell me what's wrong here SqlConnection Con = new SqlConnection(ConfigurationManager.ConnectionStrings [" Build"]。ToString()); string string build = Request.QueryString [ " buildcode"]。ToString(); Microsoft.Reporting.WebForms.ReportParameter [] param = new Microsoft.Reporting.WebForms.ReportParameter [1]; param [0] = new Microsoft.Reporting .WebForms.ReportParameter(" buildcode",buildcode); ReportViewer1.LocalReport.SetParameters(param); ReportViewer1.ServerReport.Refresh(); SqlCommand comm = new SqlCo mmand(" SurrPath_neibuild",Con); SqlParameter build_code = comm.Parameters.Add(" @ buildcode",SqlDbType.Int); build_code.Direction = ParameterDirection.Input; build_code.Value = buildcode; Con.Open(); SqlDataSource1.SelectCommandType = SqlDataSourceCommandType.StoredProcedure; SqlDataSource1.SelectCommand = comm.CommandText; Con.Close(); 我想知道出了什么问题。推荐答案 Font-Size =" 8pt" 高度 =" 400px" 宽度 =" 400px">Font-Size="8pt" Height="400px" Width="400px"> < LocalReport ReportPath =" Report1.rdlc"><LocalReport ReportPath="Report1.rdlc"> < DataSources ><DataSources> < rsweb : ReportDataSource DataSourceId =" ObjectDataSource1"<rsweb:ReportDataSource DataSourceId="ObjectDataSource1"  名称 =" DS_Build_DataTable1" />Name="DS_Build_DataTable1" /> < / DataSources ></DataSources> < / LocalReport ></LocalReport> < / rsweb : ReportViewer ></rsweb:ReportViewer> < asp : ObjectDataSource ID =" ObjectDataSource1" runat =" server"<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"  SelectMethod =" GetData"SelectMethod="GetData"  TypeName =" Test.DataSetTableAdapters.DS_TableAdapter">TypeName="Test.DataSetTableAdapters.DS_TableAdapter"> < / asp : ObjectDataSource > b)或者,您可以使用ReportViewer.LocalMode.DataSources.Add(reportDataSource)在代码中设置数据源; 谢谢。 Stella Chan 项目经理 SQL Server Reporting Services ----------------- 本帖子按原样提供,不提供任何支持或担保</asp:ObjectDataSource>b)  Alternatively, you can set the data source in code using ReportViewer.LocalMode.DataSources.Add(reportDataSource);Thanks.Stella ChanProgram ManagerSQL Server Reporting Services-----------------This post is provided as-is with no support or warranty. 这篇关于尚未为数据源“DS_Build_DataTable1”提供数据源实例。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-20 18:02