Hi everybody!
I have a question about tuning my VB6 "INSERT" procedure.
I have 5000 entries in a vb6 array that I need to insert in a SQLserver2K table.
My INSERT procedure takes about 11-12 secondes to process all the insertion. Can I speed up my procedure?
Here is my code:
Public Sub loopInsertInDB(cnx As adodb.Connection)
Dim statement As String
Dim commande As New adodb.Command
Dim i As Integer
i = 0
idxArray = ubound(TABDATA)
While i < idxArray
statement = "INSERT INTO R27 " & _
"( v, w, x, y, z) " & _
" VALUES (" & _
"'" & TABDATA(i).strV & "', " & _
"'" & TABDATA(i).strW & "', " & _
"'" & TABDATA(i).strX & "', " & _
"'" & TABDATA(i).strY & "', " & _
"'" & TABDATA(i).strZ & "'" & ""
With commande
'.Prepared = True 'where should i use it?
.ActiveConnection = cn
.CommandText = statement
.CommandType = adCmdText
.Execute
End With
i = i + 1
Wend
Set commande = Nothing
End Sub
By the way, how and where do i use the prepared property
Thank you!
Vt
I have a question about tuning my VB6 "INSERT" procedure.
I have 5000 entries in a vb6 array that I need to insert in a SQLserver2K table.
My INSERT procedure takes about 11-12 secondes to process all the insertion. Can I speed up my procedure?
Here is my code:
Public Sub loopInsertInDB(cnx As adodb.Connection)
Dim statement As String
Dim commande As New adodb.Command
Dim i As Integer
i = 0
idxArray = ubound(TABDATA)
While i < idxArray
statement = "INSERT INTO R27 " & _
"( v, w, x, y, z) " & _
" VALUES (" & _
"'" & TABDATA(i).strV & "', " & _
"'" & TABDATA(i).strW & "', " & _
"'" & TABDATA(i).strX & "', " & _
"'" & TABDATA(i).strY & "', " & _
"'" & TABDATA(i).strZ & "'" & ""
With commande
'.Prepared = True 'where should i use it?
.ActiveConnection = cn
.CommandText = statement
.CommandType = adCmdText
.Execute
End With
i = i + 1
Wend
Set commande = Nothing
End Sub
By the way, how and where do i use the prepared property
Thank you!
Vt