Partilhar via


Método ServerReport.GetDataSources

Retrieves information about the data sources used for a report.

Namespace:  Microsoft.Reporting.WebForms
Assembly:  Microsoft.ReportViewer.WebForms (em Microsoft.ReportViewer.WebForms.dll)

Sintaxe

'Declaração
Public Function GetDataSources As ReportDataSourceInfoCollection
public ReportDataSourceInfoCollection GetDataSources()
public:
ReportDataSourceInfoCollection^ GetDataSources()
member GetDataSources : unit -> ReportDataSourceInfoCollection 
public function GetDataSources() : ReportDataSourceInfoCollection

Valor de retorno

Tipo: Microsoft.Reporting.WebForms.ReportDataSourceInfoCollection
A ReportDataSourceInfoCollection containing ReportDataSourceInfo objects.

Comentários

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

Exemplos

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

Consulte também

Referência

ServerReport Classe

Sobrecargas GetDataSources

Namespace Microsoft.Reporting.WebForms