ServerReport.GetDataSources 方法
检索有关用于报表的数据源的信息。
命名空间: Microsoft.Reporting.WebForms
程序集: Microsoft.ReportViewer.WebForms(在 Microsoft.ReportViewer.WebForms.dll 中)
语法
声明
Public Function GetDataSources As ReportDataSourceInfoCollection
用法
Dim instance As ServerReport
Dim returnValue As ReportDataSourceInfoCollection
returnValue = instance.GetDataSources()
public ReportDataSourceInfoCollection GetDataSources()
public:
ReportDataSourceInfoCollection^ GetDataSources()
member GetDataSources : unit -> ReportDataSourceInfoCollection
public function GetDataSources() : ReportDataSourceInfoCollection
返回值
类型:Microsoft.Reporting.WebForms.ReportDataSourceInfoCollection
一个包含 ReportDataSourceInfo 对象的 ReportDataSourceInfoCollection。
注释
此方法返回在可以提示输入凭据的报表中使用的任何数据源的数据源名称和用户提示字符串。
示例
private void button1_Click(object sender, EventArgs e)
{
ReportDataSourceInfoCollection rdsic =
this.reportViewer1.ServerReport.GetDataSources();
foreach (ReportDataSourceInfo rdsi in rdsic)
{
Debug.WriteLine(rdsi.Name + ":" + rdsi.Prompt);
}
}
Private Sub Button2_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button2.Click
Dim rdsic As ReportDataSourceInfoCollection = _
ReportViewer1.ServerReport.GetDataSources
For Each rdsi As ReportDataSourceInfo In rdsic
Debug.WriteLine(rdsi.Name + ":" + rdsi.Prompt)
Next
End Sub