Dim DataTabSelf As DataTable = DataTables("表A")
If DataTables.Contains("Data_" & DataTabSelf.Name) = True Then '如果表已经加载
Return Nothing '则退出函数
End If
'1.2为取来源表建立第二批空间
Dim SumRow As Integer = DataTabSelf.DataRows.Count
Dim SumCol As Integer = DataTabSelf.DataCols.Count
Dim TotalCell As Integer = DataTabSelf.DataRows.Count*DataTabSelf.DataCols.Count
Dim BaseTabName As String = "Data_" & DataTabSelf.Name
Dim RowEmpty As Integer
RowEmpty = 4
Dim RowCap(RowEmpty) As String
If TotalCell > 5240 Then '如果数据过多,接近5250个上限
MessageBox.Show("数据过多,接近5250个上限,退出")
Return Nothing '则退出函数
End If
'1.3为目标表建立空间并复制表列,仅复制结构,不复制数据
Dim Builder As New ADOXBuilder
Dim tbl As ADOXTable
Dim i As Integer = 0
Dim j As Integer = 0
Dim LeiXing As Integer
Dim DcName As String
Dim DcCaption As String
Dim DcDatatype As Object
Dim DcMaxlength As String
Builder.Open()
tbl = Builder.NewTable( "Data_" & DataTabSelf.Name)
With tbl
.AddColumn( "RowColLable" ,ADOXType.String ,16)
.AddColumn( "RowColContent" ,ADOXType.String ,200)
For Each dc As DataCol In DataTabSelf.DataCols
DcName = dc.Name
DcCaption =dc.Caption
If dc.IsBoolean Then
DcDatatype = ADOXType. Boolean
ElseIf dc.IsDate Then
DcDatatype = ADOXType. DateTime
ElseIf dc.IsNumeric Then
If dc.datatype.Name = "Double" Then
DcDatatype = ADOXType.Double
ElseIf dc.datatype.Name = "Decimal"
DcDatatype = ADOXType.Decimal
End If
ElseIf dc.IsString Then
DcDatatype = ADOXType.String
End If
DcMaxlength =dc.MaxLength
.AddColumn( DcName ,DcDatatype ,DcMaxlength)
Next
End With
Builder.AddTable(tbl) '增加表
Builder.Close()
If DataTables.Contains("Data_" & DataTabSelf.Name) = False Then '如果新表没有加载
DataTables.Load("Data_" & DataTabSelf.Name) '加载新表
End If