select SQLステートメントから(メモリ内に)データテーブルを作成するコードがあります。ただし、このデータテーブルは、トランザクションcomitステートメントの結果ではなく、プロシージャ中にいっぱいになっていることに気付きました。このデータテーブルは機能しますが、処理が遅くなります。私は何を間違っているのですか?
Inalready.Clear() 'clears a dictionary
Using connection As New SQLite.SQLiteConnection(conectionString)
connection.Open()
Dim sqliteTran As SQLite.SQLiteTransaction = connection.BeginTransaction()
Try
oMainQueryR = "SELECT * FROM detailstable Where name= :name AND Breed= :Breed"
Dim cmdSQLite As SQLite.SQLiteCommand = connection.CreateCommand()
Dim oAdapter As New SQLite.SQLiteDataAdapter(cmdSQLite)
With cmdSQLite
.CommandType = CommandType.Text
.CommandText = oMainQueryR
.Parameters.Add(":name", SqlDbType.VarChar)
.Parameters.Add(":Breed", SqlDbType.VarChar)
End With
Dim c As Long = 0
For Each row As DataRow In list.Rows 'this is the list with 500 names
If Inalready.ContainsKey(row.Item("name")) Then
Else
c = c + 1
Form1.TextBox1.Text = " Fill .... " & c
Application.DoEvents()
Inalready.Add(row.Item("name"), row.Item("Breed"))
cmdSQLite.Parameters(":name").Value = row.Item("name")
cmdSQLite.Parameters(":Breed").Value = row.Item("Breed")
oAdapter.Fill(newdetailstable)
End If
Next
oAdapter.FillSchema(newdetailstable, SchemaType.Source)
Dim z = newdetailstable.Rows.Count
'この時点で、newdetailstableはすでにいっぱいになっていて、トランザクションをコミットしていません。
' sqliteTran.Commit()
Catch ex As Exception
End Try
End Using