Dim dtb As New DataTableBuilder("新表")
For Each dc As DataCol In DataTables("原表").DataCols
If dc.IsString Then dtb.AddDef(dc.Name, GetType(String),dc.MaxLength)
If dc.IsNumeric Then dtb.AddDef(dc.Name, GetType(Integer))
If dc.IsDate Then dtb.AddDef(dc.Name, GetType(Date))
If dc.IsBoolean Then dtb.AddDef(dc.Name, GetType(Boolean))
Next
dtb.Build()
'复制 默认值 表达式 禁止重复等信息
For Each dc As DataCol In DataTables("原表").DataCols
With DataTables("新表").DataCols(dc.Name)
.Unique = dc.Unique
.DefaultValue = dc.DefaultValue
If dc.Expression <> "" Then
.Expression = dc.Expression
End If
End With
Next
缺陷是没办法区分Integer 和double等数值列。。