Re: lengthy operation



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 when
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,
adLockOptimistic,
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




.



Relevant Pages

  • Re: lengthy operation
    ... I use VC7.1 and ADO. ... pConnection, true, adOpenKeyset, adLockOptimistic, adCmdText); ... Client-sided and UpdateBatch mode as ADO is optimised to populate waves of ...
    (microsoft.public.data.ado)
  • Re: Workdays function with Australian Dates
    ... Why would ADO make a difference here? ... cnD.Execute strSQL,, adCmdText + adExecuteNoRecords ... 17.03.2006 ADO ODBC number ...
    (comp.databases.ms-access)
  • Strange problem in Jet 4.0 with updates in multithreading application
    ... I'me using ADO with OLEDB provider for Jet 4.0. ... rs.CursorLocation = CursorLocation ... rs.Open sql, conn, CursorType, LockType, adCmdText ...
    (microsoft.public.data.ado)
  • Datumsformat in gespeicherten Views einer Oracle-DB
    ... Meine SQL-Kommandos führe ich nach diesem Muster aus: ... .CommandType = adCmdText ... SQL-Developer einwandfrei funktioniert über ADO Fehlermeldungen verursacht. ... Auch hier erhalte ich die Fehlermeldung ORA-01847. ...
    (microsoft.public.de.vb.datenbank)
  • Re: Workdays function with Australian Dates
    ... have you tried that number trick on SQL server using ADO? ... cnD.Execute strSQL,, adCmdText + adExecuteNoRecords ... 17.03.2006 ADO ODBC number ...
    (comp.databases.ms-access)