Windsailor
Well-known member
- Joined
- Aug 2, 2006
- Messages
- 45
- Programming Experience
- 1-3
[FONT="]The following code takes approx 4 min to insert 3000 records into a local mdb database.
Using another database engine and provider the same code takes 5 seconds, why?
[/FONT][FONT="]I have tried indexing and not indexing the column etc. and it still takes around 4 min to insert 3000 records, which is absolutely terrible.
I am missing something...
Is there a better way to do this?[/FONT]
[FONT="]
[/FONT]
[FONT="]
Thanks
[/FONT]
Using another database engine and provider the same code takes 5 seconds, why?
[/FONT][FONT="]I have tried indexing and not indexing the column etc. and it still takes around 4 min to insert 3000 records, which is absolutely terrible.
I am missing something...
Is there a better way to do this?[/FONT]
[FONT="]
[/FONT]
VB.NET:
[FONT="]Dim A As Double
Dim X As Double
Dim XVal As Double
Me.Txt2.Focus()
A = Val(Me.Txt2.Text) 'To set the incremental value
Me.Txt4.Focus()
X = Val(Me.Txt4.Text) 'To set the Max value
XVal = 0
cmd.CommandText = "INSERT INTO MyTableName(Column1)VALUES (@Column1)"
cmd.Connection = conn
conn.Open()
Do Until XVal >= X
If XVal < X Then
XVal = (XVal + A)
cmd.Parameters.Add(New System.Data.OleDb.OleDbParameter("@Column1", XVal))
cmd.Parameters("@Column1").Value = XVal
cmd.ExecuteNonQuery()
Else
Exit Do 'Exit Loop
End If
Loop
conn.Close()
conn.Dispose()
conn = Nothing
[/FONT]
Thanks
[/FONT]