次の方法で共有


ServerReport.GetDataSources メソッド ()

 

発行: 2016年4月

レポートに使用するデータ ソースに関する情報を取得します。

名前空間:   Microsoft.Reporting.WinForms
アセンブリ:  Microsoft.ReportViewer.WinForms (Microsoft.ReportViewer.WinForms.dll 内)

構文

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

戻り値

Type: Microsoft.Reporting.WinForms.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

参照

GetDataSources オーバーロード
ServerReport クラス
Microsoft.Reporting.WinForms 名前空間

トップに戻る