ADO faster than ADO.net ?
- From: bdwest <bdwest@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 29 Jun 2005 07:31:06 -0700
I would like to know why I can use ADO (ADODB record set) running in vb.net
to insert records into an MS Access database 5-6 times faster than I can
using ADO.net. We may be inserting tens of thousands of records at a time
and performance becomes an issue. Let me also say I am required to use
Access by company and clients so I am stuck with that limitation.
Most of the stuff I have read implies that ADO.net should be faster. I
find just the opposite for inserting large number or records in Access. I
don't know if I am being inefficient in the ADO.net code or what. I would
appreciate any input.
I have a small vb.net project that inserts 30,000 records into a database
using ADO as shown in the code fragment below. It also includes 3 ADO.net
methods as well. It tells you the time in seconds it took to complete the
write. On my machine the ADODB record set method inserts 30,000 records in
6 seconds. The ADO.net methods take 30-37 seconds depending on method.
If you are interested, the project is available at this URL:
http://www.kelbli.net/pub/transfer/DBtest.zip
The database is in the bin directory (make sure you extract with relative
paths enabled).
Any help would be appreciated.
Brian
*********************************************************
ADO code fragment:
'create and open record set
Dim rstData As ADODB.Recordset
rstData = New ADODB.Recordset
rstData.Open("Table1", db, ADODB.CursorTypeEnum.adOpenKeyset,
ADODB.LockTypeEnum.adLockOptimistic, ADODB.CommandTypeEnum.adCmdTable)
'insert records
For x = 1 To 30000
rstData.AddNew()
d = DateAdd(DateInterval.Day, x, #1/1/1925#)
rstData.Fields.Item(0).Value = "M1"
rstData.Fields.Item(1).Value = d
rstData.Fields.Item(2).Value = x
rstData.Fields.Item(3).Value = x ^ 2
rstData.Update()
Next
.
- Follow-Ups:
- Re: ADO faster than ADO.net ?
- From: Tym
- Re: ADO faster than ADO.net ?
- From: Cor Ligthert
- Re: ADO faster than ADO.net ?
- Prev by Date: Re: export dataset to excel
- Next by Date: checking for valid connection
- Previous by thread: Foreign Key Violations During Insert in Transaction
- Next by thread: Re: ADO faster than ADO.net ?
- Index(es):
Relevant Pages
|
Loading