Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / Database Access / August 2005



Tip: Looking for answers? Try searching our database.

Recordset query?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
William Barnes - 28 Aug 2005 17:08 GMT
I'm working on a project in which I retrieve a recordset from a database and
then save a local copy as an adtg file. What I'd like to do is then be able
to excute an SQL query on that recordset. Can anyone help me with the syntax
for that? It looks like I could do something like this:

Dim oRstSrc as ADODB.Recordset
Dim oRstDest as ADODB.Recordset
dim strSQL as String

'Retrieve saved recordset into oRstSrc...

'Create SQL Query and store it in strSQL...

Set oRstDest = oRstSrc.Open(...    'Then what?

Or maybe there's another way it should be done, if it can be done at all.

Thanks,
William
brijeshmathew@gmail.com - 28 Aug 2005 17:55 GMT
Hello William

You might wanna try something like this..

Dim oRstSrc as New ADODB.Recordset
Dim oRstDest as New ADODB.Recordset
Dim lConnection as New ADODB.Connection
dim strSQL as String

lConnection.CursorLocation = aduseServer or aduseclient
lconnection.ConnectionString = "specify your connection parameters"
lconnection.Open

strSQL = "SELECT * from TABLE"

oRstSrc.CursorLocation = adUseServer
oRstSrc.CursorType = adOpenDynamic
oRstSrc.LockType = adLockPessimistic
oRstSrc.Open strSQL, lConnection

Hope that helps

Regards

Brijesh Mathew
William Barnes - 28 Aug 2005 22:19 GMT
Thanks for your prompt reply, Brijesh

I'm not quite following your example. Basically what I want to do is to
reteieve a subset of records from an existing Recordset object. For example,
let's say I had a database containing info about books that resided on a
server somewhere. One day I retrieve a Recordset containing all the fields
of all the records from the Books table. Then, and this is one of the main
points, I save that recordset to the hard drive of my laptop as
MyRecset.adtg.

Now imagine that I am working somewhere without internet connectivity (thus
unable to connect to the original database on our server) and I want to
generate a subset of the records contained in MyRecset.adtg. For instance, I
might want to get a Recordset containing all records in which the
publication date was before a certain date.Thus I can do something like
this:

Dim oRecsetMain as Recordset
Const sLocalPath as String = "C:\MyDir\MyRecset.adtg"

oRecsetMain.Open sLocalPath

So now I have a Recordset containing all of the records from the main
database. But what I want is a Recordset that would be the same as that
which might have resulted from a query to the main database with something
like "SELECT * FROM Books WHERE PubDate < 10/31/1995".

How can I get a Recordset out of oRecsetMain that contains only those
records?

Thanks
WIlliam

> Hello William
>
[quoted text clipped - 21 lines]
>
> Brijesh Mathew
Adrian Moore - 28 Aug 2005 23:09 GMT
William

You might be interested in the assembly I've been working on at
http://www.queryadataset.com/recordsets.aspx.  It lets you perform complex
SQL SELECT statements including UNION, JOINS, GROUP BY, HAVING, ORDER BY,
sub-queries, aggregates, functions etc against the recordsets. The
QueryRecordsets assembly allows Visual Basic 6.0 or ASP web developers to
perform complex SQL queries against cached ADO recordsets.

Hope this helps
Adrian Moore
http://www.queryadataset.com

> I'm working on a project in which I retrieve a recordset from a database
> and then save a local copy as an adtg file. What I'd like to do is then be
[quoted text clipped - 15 lines]
> Thanks,
> William
William Barnes - 28 Aug 2005 23:31 GMT
Thanks Adrian
I will have a look at that. Since my last post I've been playing around with
using the Recordset.Filter property. I may be able to get what I need with
that.
WIlliam

> William
>
[quoted text clipped - 28 lines]
>> Thanks,
>> William
Ellie - 30 Aug 2005 16:31 GMT
Hi William,

I just posted the same question.. Have you had any success?

Thanks,

Ellie

> Thanks Adrian
> I will have a look at that. Since my last post I've been playing around with
[quoted text clipped - 34 lines]
> >> Thanks,
> >> William
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.