For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic Database > May 2005 > Disconnected recordsets









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Disconnected recordsets
Griff

2005-05-04, 8:59 am

I know that it is possible to create an ADODB.RECORDSET without an
underlying datasource.

What I'd like to do would be to create a recordset, populate it and then add
ALL the rows to an existing SQL table.

I can create one with fields that map exactly onto the fields of a DB table
(except the IDENTITY field) and populate it, but I don't know how to tell it
to now dump all that information into the database table.

Any advice?

Thanks

Griff


Griff

2005-05-04, 8:59 am

Think I've answered this myself...

I create a recordset and make the source:

SELECT TOP 0 * FROM myTable

And THEN populate it, then fire "updateBatch"

G


Stephen Howe

2005-05-04, 4:01 pm

> What I'd like to do would be to create a recordset, populate it and then
add
> ALL the rows to an existing SQL table.


Do one of

SELECT * FROM yourtable WHERE 0=1
or
SELECT field1,field2,...,fieldN FROM yourtable WHERE 0=1

The 0=1 means the recordset will be empty but the fields and types will be
correct.

Stephen Howe


Douglas Marquardt

2005-05-04, 4:01 pm

Hi Griff:

I would suggest using the method Stephen posted instead;

the "WHERE 0=1" method works on most (if not all) db platforms,
while the "TOP 0" method is a MS/SQL Svr thing.

Doug.


"Griff" <Howling@The.Moon> wrote in message news:ua5CsjHUFHA.3952@TK2MSFTNGP15.phx.gbl...
> Think I've answered this myself...
>
> I create a recordset and make the source:
>
> SELECT TOP 0 * FROM myTable
>
> And THEN populate it, then fire "updateBatch"
>
> G
>
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com