Dim d1 As Date = Date.Now
Dim cmd As New SQLCommand
cmd.C
Dim cmd2 As New SQLCommand
cmd2.C
Dim str1 As String, str2 As String
Dim dt As DataTable
Dim lst As List(Of String)
lst = Connections("数据源1").GetTableNames
For Each nm As String In lst
cmd.CommandText = "SELECT * From {" & nm & " }"
dt = cmd.ExecuteReader()
For Each dr As DataRow In dt.DataRows
str1= ""
str2= ""
For Each dc As DataCol In dt.DataCols
str1 = str1 & dc.name & ","
If dc.IsString Then
str2 = str2 & "'" & dr(dc.name) & "',"
ElseIf dc.IsNumeric
str2 = str2 & "" & dr(dc.name) & ","
ElseIf dc.IsBoolean Then
str2 = str2 & "," & dr(dc.name)& ","
ElseIf dc.IsDate Then
str2 = str2 & "#" & dr(dc.name) & "#"
End If
Next
str1 = str1.TrimEnd(",")
str2 = str2.trimEnd(",")
cmd2.CommandText = "Insert Into " & nm & " (" & str1 & ") Values (" & str2 & ")"
cmd2.ExecuteReader()
Next
Next
Dim d2 As Date = Date.Now
MessageBox.Show((d2-d1).Totalseconds)
MessageBox.Show("成功")
代码现在改成这样 ,但是执行了却没有导入成功.