我有这段代码,但它只插入了 54 条记录中的 7 条记录。我确信数据表中的记录很好。
Dim dt As DataTable
Dim sc As SQLiteCommand
Dim Script As String = Nothing
Dim Script2 As String = Nothing
Dim Script3 As String = Nothing
Script = "insert into paperdate(dtime,papernum,paperstat,user) select " & "'" & dt.Rows(0)(0) & "'" & " as " & "dtime" & "," & dt.Rows(0)(1) & " as " & "papernum" & "," & "'" & dt.Rows(0)(2) & "'" & " as " & "paperstat" & "," & "'" & dt.Rows(0)(3) & "'" & " as " & "user"
For i As Integer = 1 To dt.Rows.Count - 1
Script2 = " union select " & "'" & dt.Rows(i)(0) & "'" & "," & dt.Rows(i)(1) & "," & "'" & dt.Rows(i)(2) & "'" & "," & "'" & dt.Rows(i)(3) & "'"
Script3 = Script3 & Script2
Next
sc = New SQLiteCommand(Script & Script3, mycon)
sc.ExecuteNonQuery()
sc.Dispose()
希望有大神解答,谢谢