ServerReport.GetDataSources 方法 ()

Retrieves information about the data sources used for a report.

命名空间: Microsoft.Reporting.WinForms
程序集: Microsoft.ReportViewer.WinForms (在 microsoft.reportviewer.winforms.dll 中)

语法

声明
用法

返回值

A ReportDataSourceInfoCollection that contains ReportDataSourceInfo objects.

备注

This method returns the data source names and user prompt strings of any data sources used in the report that can prompt for credentials.

示例

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

另请参见

参考

ServerReport 类
ServerReport 成员
Microsoft.Reporting.WinForms 命名空间