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
If dc.IsString Then
str1 = str1 & dc.name & ","
str2 = str2 & "'" & dr(dc.name) & "',"
ElseIf dc.IsNumeric Then
str1 = str1 & dc.name & ","
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("成功")
在群里弄了半天 数值和时间还有逻辑怎么转?字符型搞定了.