Re: lengthy operation



Sorry Bob, I did not read all your post !
thanks a lot, it's not very practical to use a SQL insert statement when we
have many fields. So your advice about how to open the recordset to retreive
no results is excellent !
I will try this now ....

"Bob Barrows [MVP]" <reb01501@xxxxxxxxxxxxxxx> wrote in message
news:ein9CaMDHHA.3524@xxxxxxxxxxxxxxxxxxxxxxx
Mike wrote:
I am not using .NET framework. I am using visual studio .NET 2003
because it is better then the visual studio 6.
I do not want to use the ADO .NET because I don't want to use the .NET
framework. Maybe it is a bad choice ....

I can't say. Did you read my entire reply?


is there a big difference between ado and ado .NET to do what I want ?

Not really. Executing a sql insert statement is done pretty much the same
way with both technologies. Basically, create a string containing an
insert statement that does what you want, something like:

"insert into table (column list) values (value list)"

and use the connection's Execute method to execute it

You will probably want to parameterize it and use parameters to pass the
values into the statement. I'm not really familiar with c++ so if you get
no further replies here, you should probably take this to a c++ group.

Retrieving data is quite different: datasets instead of recordsets, etc.

If you MUST use a recordset to do this, then do not use adCmdTable: use
adCmdText instead and put a WHERE clause on the sql statement:


"select <columns> from table where 0=1"

This where clause will cause the query to return an empty resultset. You
can then add a new record to the recordset.


thanks
Mike

"Bob Barrows [MVP]" <reb01501@xxxxxxxxxxxxxxx> wrote in message
news:O0PJHAMDHHA.4992@xxxxxxxxxxxxxxxxxxxxxxx
Mike wrote:
Hi !

I am a beginner in ado programming and I have some problems with
operations on huge tables. I am developping with visual studio .NET
2003.

Why are you using classic ADO in .Net? Since you have VS 2003, go
look in the online help for tutorials about working with data.



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.

Use a SQL INSERT statement executed by a Command object. Don't use a
recordset


I used the following code to open the recordset :
pRecordSet->Open("table", pConnection, true, adOpenKeyset,
adLockOptimistic, acCmdTable);


I have never used adCmdTable to open a recordset. I ALWAYS create a
sql select statement with a WHERE clause to limit the data retrieved
from the database.

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so
I don't check it very often. If you must reply off-line, then remove
the "NO SPAM"

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"



.



Relevant Pages

  • Re: How does ADO 2 update a SQL stored procedure recordset?
    ... > Generally when I want to use ADO 2 to update a recordset based on a MSSQL ... > call a second stored procedure to perform the update. ... Well if you have SELECTed the columns in the recordset that form the Primary ... You are running SQL Server. ...
    (microsoft.public.data.ado)
  • Re: Emailing a Report
    ... the reason Debug.Print was done was to test the SQL of what is being generated. ... If you will add and change data here, you need to set this up as a main/subform -- or just a main form that DISPLAYS data from Users and allows modifications to Agreements. ... If you are just going to send Agreements, then AgrID should be added to the form RecordSet so you can capture it. ... maybe also some kind of category for this followup type ...
    (microsoft.public.access.modulesdaovba)
  • Re: ADO to mdb joins
    ... Do this NOT using a linked (SQL) table, but using an ADO ... >> Currently, I am using an ADO connection to return an ADO recordset, ... > Through query to get SQL data. ...
    (microsoft.public.access.queries)
  • Re: Database novice questions
    ... All the methods you mentioned are ADO. ... code (either presentation or business layer) and OLE DB (which provides the ... You can execute SQL statements against the Connection object directly: ... when no recordset has to be returned ...
    (microsoft.public.vb.general.discussion)
  • Re: What is the advantage of Event programming?
    ... >> dice what lumps of data you need. ... which wouldn't work if the recordset has more than ... >My knowledge on using SQL statements is somewhat limited. ... Requesting a limited number of records at a time, was useful in the old days ...
    (microsoft.public.vb.general.discussion)