创建属性datarow [英] Create property datarow
问题描述
员工
我想 创建 属性
其中内容 将收到 datarow ,
我 只是 没有 ,
property 设置 正确 相对于
创建 datarow variable,
否 问题 , 直到 我意识到她
要求 添加 ( ) ,
now 属性 我无法识别 ,
如何正确 定义数据 ?
I am wanting to create a property where the content will receive a datarow, I'm just not getting, is property set correctly in relation to creating a datarow variable, with no problem, until I realized she asks to add (), now the property I could not identify, how to properly define the data?
1)按物业
私人c_row_tb_Table As DataRow
Private c_row_tb_Table As DataRow
公共财产row_tb_Table As DataRow
获取¥b $ b 返回Me.c_row_tb_Table
结束获取¥b $ b 设置(ByVal Value As DataRow)
Me.c_row_tb_Table =价值
结束集
结束属性
Public Property row_tb_Table As DataRow
Get
Return Me.c_row_tb_Table
End Get
Set(ByVal Value As DataRow)
Me.c_row_tb_Table = Value
End Set
End Property
Me.cl_tb_SIS.row_tb_Table = Me.cl_tb_SIS.tb_Column.Select(" ic_Is_Field_Omnis ='N'"," id_Tabela,id_Coluna ASC")
Me.cl_tb_SIS.row_tb_Table = Me.cl_tb_SIS.tb_Column.Select("ic_Is_Field_Omnis = 'N'", "id_Tabela,id_Coluna ASC")
错误1
类型的值
'1- System.Data.DataRow'的维数组'无法转换为'System.Data.DataRow'。
Error 1
Value of type
'1-dimensional array of System.Data.DataRow' cannot be converted to 'System.Data.DataRow'.
2)变量
2) by variable
Dim row_tb_Column()As DataRow
row_tb_Table = Me.cl_tb_SIS.tb_Column.Select(" ic_Is_Field_Omnis ='N'"," id_Tabela,id_Coluna ASC")
Dim row_tb_Column() As DataRow
row_tb_Table = Me.cl_tb_SIS.tb_Column.Select("ic_Is_Field_Omnis = 'N'", "id_Tabela,id_Coluna ASC")
推荐答案
Select方法返回一个DataRow对象数组,因此您应该使用FirstOrDefault()方法获取可以将属性分配给的单个DataRow对象:
The Select method returns an array of DataRow objects so you should use the FirstOrDefault() method to get a single DataRow object that you can assign your property to:
Me.cl_tb_SIS.row_tb_Table = Me.cl_tb_SIS.tb_Column.Select("ic_Is_Field_Omnis = 'N'", "id_Tabela,id_Coluna ASC").FirstOrDefault()
Dim row_tb_Column As DataRow
row_tb_Column = Me.cl_tb_SIS.tb_Column.Select("ic_Is_Field_Omnis = 'N'", "id_Tabela,id_Coluna ASC").FirstOrDefault()
请不要两次提出同样的问题,请记得将有用的帖子标记为答案。
Please don't ask the same question twice and please remember to mark helpful posts as answer.
这篇关于创建属性datarow的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!