什么是Asp.Net应用程序中BindSource数据源对象的等效项? [英] What is the equivalent of BindSource Datasource object in Asp.Net application?
问题描述
大家好,
什么是Asp.Net应用程序中的BindSource数据源对象?
感谢
Hallo everyone,
What is the equivalent of BindSource Datasource object in Asp.Net application?
Thanks
推荐答案
将DataTable手动绑定到报表查看器
删除报表查看器控件上的所有设计器数据绑定
(请确保< DataSources>元素中没有任何内容,如下所示)
To manually bind a DataTable to a report viewer
Remove any designer data bindings you have on the report viewer control
(make sure there''s nothing in the <DataSources> element as shown below)
<LocalReport ReportPath="Report.rdlc">
<DataSources>
</DataSources>
</LocalReport>
在您的App_Code文件夹中添加一个新的虚拟数据集(如果有的话,请使用其中一个).在设计器中放置一个表,并添加要使用的数据表中的相同列(我将假设数据集的名称为DataSet1&DataTable的名称为DataTable1)
准备好数据集后,就可以在报表设计器中添加表或其他对象了.将字段从DataSet拖到它上.
在事件或Page_Load
中,这是将DataTable(或DataSet)中的数据绑定到报表的方法
假设您有一个名为dt的已加载数据表
Add a new dummy DataSet in your App_Code folder (or make use of one if you have). Place a table in the designer and add the same columns you have in your datatable you wish to use (I''ll assume the name of the DataSet is DataSet1 & that of DataTable is DataTable1)
Once you have your DataSet ready, you may add a table or other object in your report designer & drag fields from the DataSet onto it.
Here''s how you bind your data in DataTable (or DataSet) to the report - in a event or Page_Load
Assuming you have a loaded DataTable named dt
ReportDataSource rds = new ReportDataSource("DataSet1_DataTable1", dt);
ReportViewer1.LocalReport.DataSources.Add(rds);
ReportViewer1.DataBind();
记住要为其导入名称空间Microsoft.Reporting.WebForms
我有一个演示页面,展示了如何做-如果您需要它,请问我.我将其发送.
Remember to import namespace Microsoft.Reporting.WebForms for it
I have a little demo page showing how to do it - if you need it, ask me. I''ll send it.
http: //www.beansoftware.com/ASP.NET-Tutorials/Using-Crystal-Reports.aspx [在Visual Studio 2010中使用Crystal Reports生成报告 [ http://forums.asp.net/t/1467325.aspx [ http://www.dotnetking.com/ArticleDetails.aspx?ArticleID=44 [ ^ ]
http://www.beansoftware.com/ASP.NET-Tutorials/Using-Crystal-Reports.aspx[^]
Generate a report using Crystal Reports in Visual Studio 2010[^]
http://forums.asp.net/t/1467325.aspx[^]
http://www.dotnetking.com/ArticleDetails.aspx?ArticleID=44[^]
这篇关于什么是Asp.Net应用程序中BindSource数据源对象的等效项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!