Is there a way to execute an SQL statement on a recordset? 
Author Message
 Is there a way to execute an SQL statement on a recordset?

Hi all,

I know that you can connect to a database and create a recordset thru an SQL
string, but say you have a recordset and you want to quicly retrieve sums,
averages or create a groupped recordset.

Suppose you have saved an ADO recordset thru the save method in the default
adtg format.
Now you want to query that recordset to get info about specific columns,
such as sums or counts.

In my mind that would be something like this:

Dim MyConn As ADODB.Connection
Set MyConn = CreateObject("ADODB.Connection")
MyConn.Open "Provider=MSPersist;"
' bogus, this won't work
sql = "SELECT `Quantity`, COUNT(`Quantity`) AS MyTable FROM 'C:\Test.vbd'"
Set rsTotals = MyConn.Execute(sql)

Obviously this doesn't work.

Is there a way?

Thanks,

Andy.



Tue, 04 Jan 2005 00:35:27 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. errors different when executing SQL statements via recordset or connection object

2. SQL Statement Executed by Recordset

3. Write One SQL statement execute in Oracle and SQL Server

4. Recordset Experts...SQL statement on an open recordset?

5. Returned recordset is closed when executing stored procedure with Insert Into statement

6. Can't execute a user define function in an SQL statement

7. Executing a v.long SQL script with multiple go statements

8. How to execute a long SQL statement?

9. Executing UPDATE SQL statements in DAO 3.5 and VB5

10. SQL statement error (Problem when more than once execute)

11. How to execute an SQL statement on a datacontrol

12. How to execute 2 SQL statements in the user-defined query

 

 
Powered by phpBB® Forum Software