ReportDataSource 建構函式 (String, Object)
發行︰ 2016年4月
以值來建構具名資料來源。
命名空間: Microsoft.Reporting.WinForms
組件: Microsoft.ReportViewer.WinForms (於 Microsoft.ReportViewer.WinForms.dll)
語法
public ReportDataSource(
string name,
object dataSourceValue
)
public:
ReportDataSource(
String^ name,
Object^ dataSourceValue
)
new :
name:string *
dataSourceValue:Object -> ReportDataSource
Public Sub New (
name As String,
dataSourceValue As Object
)
參數
name
Type: System.String資料來源的名稱。
dataSourceValue
Type: System.Object資料來源的值。
註解
Value 可以是 DataTable 的執行個體、IEnumerable 值 (例如 DataView 或 Array) 或 BindingSource。
如果這個值是 IEnumerable 的執行個體,集合中所有元素都必須是相同的類型,且元素的公用屬性名稱 (依 M:System.ComponentModel.TypeDescriptor.GetProperties 方法所擷取) 必須符合對應報表資料來源的欄位名稱。
Value 也可以是 Type 的執行個體。在這個情況下,會自動建立所提供之類型的執行個體,並加入自動建立的集合中。
如果 Value 的類型不是任何上述類型,就會加入自動建立的集合。
範例
如需程式碼範例,請參閱 LocalReport。
另請參閱
ReportDataSource 多載
ReportDataSource 類別
Microsoft.Reporting.WinForms 命名空間
回到頁首