Link to home
Start Free TrialLog in
Avatar of ChenChen
ChenChenFlag for Afghanistan

asked on

set recordset returned by command.execute to a datagrid

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

ASKER CERTIFIED SOLUTION
Avatar of Rick_Townsend
Rick_Townsend

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Rick_Townsend
Rick_Townsend

The equivalent in command.execute is adAsynchFetch

See this link for specs:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/mdmthcmdexecute.asp