国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > .NET > 正文

ADO.NET對象的構造(4)_DataColumn(續)

2024-07-10 12:59:38
字體:
來源:轉載
供稿:網友
n overloads public overridable function add() as datacolumn

n overloads public sub add(byval column as datacolumn)

n overloads public overridable function add(byval columnname as string) as datacolumn

n overloads public overridable function add(byval columnname as string, byval type as type) as datacolumn

n overloads public overridable function add(byval columnname as string, byval type as type,byval expression as string) as datacolumn



參數

1. columnname 列的名稱。

2. column 要添加的 datacolumn。

3. type 新列的 datatype。

4. expression 要分配給 expression 屬性的表達式。



datacolumncollection 定義 datatable 的架構,并確定每個 datacolumn 可以包含什么種類的數據。可以通過 datatable對象的 columns 屬性訪問 datacolumncollection。

datacolumncollection 使用 add 和 remove 方法插入和刪除 datacolumn 對象。使用 count 屬性確定集合中有多少 datacolumn 對象。使用 contains 方法驗證集合中是否存在指定索引或列名稱。



示例

private sub addcolumn()

dim cols as datacolumncollection= dataset1.tables("orders").columns

dim mycol as datacolumn



mycol = cols.add()

with mycol

.datatype = system.type.gettype("system.decimal")

.columnname = "total"

.expression = "unitprice * quantity"

.readonly = true

.unique = false

end with



mycol = new datacolumn

with mycol

.datatype = system.type.gettype("system.decimal")

.columnname = "total"

.expression = "unitprice * quantity"

.readonly = true

.unique = false

end with

cols.add(mycol)



mycol = cols.add("total", system.type.gettype("system.decimal"), "unitprice * quantity")

mycol.readonly = true

mycol.unique = false



mycol = cols.add("total")

with mycol

.datatype = system.type.gettype("system.decimal")

.readonly = true

.expression = "unitprice * quantity"

.unique = false

end with



mycol = cols.add("total", system.type.gettype("system.decimal"))

mycol.expression = "unitprice * quantity"

mycol.readonly = true

mycol.unique = false



dim col as datacolumn

for each col in cols

console.writeline(col.columnname)

console.writeline(col.datatype.tostring)

next

end sub


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 丹寨县| 图们市| 云和县| 观塘区| 凤翔县| 宜丰县| 紫阳县| 凤阳县| 平潭县| 清镇市| 芦山县| 博乐市| 江口县| 阿克苏市| 贺兰县| 沈丘县| 济南市| 奎屯市| 平武县| 丹东市| 舟曲县| 洪泽县| 霞浦县| 昭苏县| 东光县| 淳安县| 泗洪县| 汉寿县| 合山市| 石门县| 嘉兴市| 乌拉特前旗| 虎林市| 长泰县| 阿鲁科尔沁旗| 郯城县| 清水县| 肇源县| 和龙市| 肇源县| 南和县|