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
'Declaration
Public Function GetDataSources As ReportDataSourceInfoCollection
'Usage
Dim instance As ServerReport
Dim returnValue As ReportDataSourceInfoCollection
returnValue = instance.GetDataSources
public ReportDataSourceInfoCollection GetDataSources ()
public:
ReportDataSourceInfoCollection^ GetDataSources ()
public ReportDataSourceInfoCollection GetDataSources ()
public function GetDataSources () : ReportDataSourceInfoCollection
Return Value
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.
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
Reference
ServerReport Class
ServerReport Members
Microsoft.Reporting.WinForms Namespace