set recordset returned by command.execute to a datagrid
Posted on 2004-10-21
I would like to know, if a recordset is derived from command.execute, how to get it into a datagrid?
my current code is like this:
dim rs as recordset
dim cmd as new command
set cmd.activeconnection = cn ' a valid connection
cmd.commandtext = "......" ' a valid sql statement
set rs = cmd.execute(,,adAsyncExecute)
'here is what I tend to do:
set datagrid1.datasource = rs
'it fails on 'rowset is not bookmarkable...'
I know if I use rs.open, it will be ok, like this:
set rs = new recordset
rs.open "....",cn, adOpenStatic, adLockReadOnly
set datagrid.datasource = rs
but I don't want to do this because I need the 'adAsyncExecute' - to execute the command asynchronously.
Thanks for your help