共用方式為


ReportDataSource 建構函式 (String, Object)

以值來建構具名資料來源。

命名空間:  Microsoft.Reporting.WebForms
組件:  Microsoft.ReportViewer.WebForms (在 Microsoft.ReportViewer.WebForms.dll 中)

語法

'宣告
Public Sub New ( _
    name As String, _
    dataSourceValue As Object _
)
'用途
Dim name As String
Dim dataSourceValue As Object

Dim instance As New ReportDataSource(name, dataSourceValue)
public ReportDataSource(
    string name,
    Object dataSourceValue
)
public:
ReportDataSource(
    String^ name, 
    Object^ dataSourceValue
)
new : 
        name:string * 
        dataSourceValue:Object -> ReportDataSource
public function ReportDataSource(
    name : String, 
    dataSourceValue : Object
)

參數

備註

Value 可以是 DataTable 的執行個體、IEnumerable 值 (例如 DataViewArray) 或 IDataSource

如果這個值是 IEnumerable 的執行個體,集合中所有元素都必須是相同的類型,且元素的公用屬性名稱 (依 GetProperties() 方法所擷取) 必須符合對應報表資料來源的欄位名稱。

Value 也可以是 Type 的執行個體。在這個情況下,會自動建立所提供之類型的執行個體,並加入自動建立的集合中。

如果 Value 的類型不是任何上述類型,就會加入自動建立的集合。

範例

請參閱 LocalReport,以取得程式碼範例。

請參閱

參考

ReportDataSource 類別

ReportDataSource 多載

Microsoft.Reporting.WebForms 命名空間