时间: 2021-07-31 作者:daque
n overloads public overridable function add() as datacolumnn overloads public sub add(byval column as datacolumn)n overloads public overridable function add(byval columnname as string) as datacolumnn overloads public overridable function add(byval columnname as string, byval type as type) as datacolumnn 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 en