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
)
参数
- name
类型:System.String
数据源的名称。
- dataSourceValue
类型:System.Object
数据源的值。
注释
Value 可以是 DataTable 的实例、IEnumerable 值(例如 DataView 或 Array)或者 IDataSource。
如果此值是 IEnumerable 的一个实例,则集合中的所有元素必须是同一类型,且元素的公共属性的名称(由 GetProperties() 方法检索得到)必须与对应的报表数据源的字段名称相匹配。
Value 也可以是 Type 的实例。在这种情况下,会自动创建所提供类型的实例,并将它添加到自动创建的集合中。
如果 Value 的类型不属于上述类型当中的任意一个,它会添加到自动创建的集合中。
示例
有关代码示例,请参见 LocalReport。