我只是想确保这是使用 SQLite 以获得最快性能的正确代码。
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim cons As New SQLite.SQLiteConnection
cons.ConnectionString = "Data Source=C:\database.s3db; Version=3"
cons.Open()
Using tx = cons.BeginTransaction()
Dim cmd As SQLite.SQLiteCommand
cmd = cons.CreateCommand()
For i As Integer = 0 To 1000
Try
cmd.CommandText = "INSERT INTO table1 VALUES('" & i & "')"
cmd.ExecuteNonQuery()
Catch ex As Exception
End Try
Next
tx.Commit()
cmd.Dispose()
End Using
cons.Close()
End Sub