Click to See Complete Forum and Search --> : create recordset on the fly


shvonne
October 20th, 1999, 04:45 AM
anyone know how to create recordset on the fly using ADO?? please enclose the code is possible.. thanks in advance...... good days and cheers!!!

Crazy D @ Work
October 20th, 1999, 05:02 AM
Add a reference to MS ActiveX Data Objects library, and in code you can declare something like

Dim db as ADODB.Recordset
set db = new ADODB.Recordset
db.Open "SELECT myfield FROM mytable WHERE myfield = somevalue" ' Your query here
do while not db.EOF
' do the things you want with the data
loop

db.Close
set db = nothing



Is this what you meant?

Crazy D @ Work :-)

Lothar Haensler
October 20th, 1999, 06:15 AM
do you mean something like this

dim r as ador.recordset
set r = new ador.recordset
r.fields.append "fieldname", adInteger
r.open
r.addnew
r.fields(0).value = 5
...