Share via


ServerReport.GetDataSources Method ()

 

Retrieves information about the data sources used for a report.

Namespace:   Microsoft.Reporting.WinForms
Assembly:  Microsoft.ReportViewer.WinForms (in Microsoft.ReportViewer.WinForms.dll)

Syntax

public ReportDataSourceInfoCollection GetDataSources()
public:
ReportDataSourceInfoCollection^ GetDataSources()
member GetDataSources : unit -> ReportDataSourceInfoCollection
Public Function GetDataSources As ReportDataSourceInfoCollection

Return Value

Type: Microsoft.Reporting.WinForms.ReportDataSourceInfoCollection

A ReportDataSourceInfoCollection that contains ReportDataSourceInfo objects.

Remarks

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

Examples

Legacy Code Example

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

See Also

GetDataSources Overload
ServerReport Class
Microsoft.Reporting.WinForms Namespace

Return to top