Re: lengthy operation
- From: "Mike" <michael@xxxxxxxxxxxxxxxxxxx>
- Date: Tue, 21 Nov 2006 09:18:29 +0100
Thanks Stephen for your help, I will try this and I will look at the batch
process too ... :)
"Stephen Howe" <stephenPOINThoweATtns-globalPOINTcom> wrote in message
news:eG1J97MDHHA.572@xxxxxxxxxxxxxxxxxxxxxxx
Which command can I use to insert a record in table ? my problem is whenadLockOptimistic,
I
open the recordset associated with the table (thousands of records), it
takes very long time. But I don't want to get all records, I only want to
add a new one.
I used the following code to open the recordset :
pRecordSet->Open("table", pConnection, true, adOpenKeyset,
acCmdTable);
I use VC7.1 and ADO. I have used ADO since 1999 while I have not used
everything as there is probably quite a few gaps in my knowledge, I know a
tiny bit.
As Bob says. You want
pRecordSet->Open("SELECT * FROM yourtable WHERE 0=1", pConnection, true,
adOpenKeyset, adLockOptimistic, adCmdText);
or
pRecordSet->Open("SELECT field1,field2,field3 FROM yourtable WHERE 0=1",
pConnection, true, adOpenKeyset, adLockOptimistic, adCmdText);
where you specify all the fields. The 0=1 is the only way of starting with
0
records. Setting MaxRecords to 0 wont work (0 is regarded as a special).
Often if I am just populating a table with new records I will open this
Client-sided and UpdateBatch mode as ADO is optimised to populate waves of
records reasonably fast.
Stephen Howe
.
- References:
- lengthy operation
- From: Mike
- Re: lengthy operation
- From: Stephen Howe
- lengthy operation
- Prev by Date: Re: lengthy operation
- Next by Date: Re: OracleConnection not found
- Previous by thread: Re: lengthy operation
- Next by thread: VBA ADO Connection to Oracle with Async
- Index(es):
Relevant Pages
|