For Programmers: Free Programming Magazines  


Home > Archive > ASP > June 2005 > Creating sub-recordsets









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Creating sub-recordsets
Giles

2005-06-05, 8:55 pm

How do I create a recordset from another?

e.g.
sSQL1="SELECT * FROM ThisTable"
rs1.open sSQL1,conn

sSQL2="Select * from (rs1?) WHERE name='fred' "
rs2.open sSQL2,conn

TIA
Giles


Bob Lehmann

2005-06-05, 8:55 pm

Why don't you just run the second statement to begin with?

Bob Lehmann

"Giles" <Giles@NoSpam.com> wrote in message
news:e82NolhaFHA.3040@TK2MSFTNGP14.phx.gbl...
> How do I create a recordset from another?
>
> e.g.
> sSQL1="SELECT * FROM ThisTable"
> rs1.open sSQL1,conn
>
> sSQL2="Select * from (rs1?) WHERE name='fred' "
> rs2.open sSQL2,conn
>
> TIA
> Giles
>
>



Giles

2005-06-05, 8:55 pm

The first statement takes about 5 secs to execute. Didn't make myself v
clear - the 1st statement is full of conditions, to a Search database. The
second is to filter and order search results into various categories without
having to make the main trip again.
Giles
[color=darkred]
>"Bob Lehmann" wrote > Why don't you just run the second statement to begin
>with?
>
> "Giles" wrote in message


Bob Barrows [MVP]

2005-06-05, 8:55 pm

Giles wrote:
> How do I create a recordset from another?
>
> e.g.
> sSQL1="SELECT * FROM ThisTable"
> rs1.open sSQL1,conn
>
> sSQL2="Select * from (rs1?) WHERE name='fred' "
> rs2.open sSQL2,conn
>

Use the recordset's Filter property.

Bob Barrows
PS. Avoid Selstar: http://www.aspfaq.com/show.asp?id=2096
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


Giles

2005-06-06, 3:55 am


"Bob Barrows [MVP]" wrote
> Giles wrote:
> Use the recordset's Filter property.
>
> Bob Barrows
> PS. Avoid Selstar: http://www.aspfaq.com/show.asp?id=2096


Thanks Bob. I do avoid * where poss since joining this NG - almost as bad as
top (or bottom) posting! However, the article seems to suggest that if you
want all fields, it is better to explicitly name the lot. Is that right?
Does everyone do that?
Giles


Bob Barrows [MVP]

2005-06-06, 3:55 am

Giles wrote:
> "Bob Barrows [MVP]" wrote
>
> Thanks Bob. I do avoid * where poss since joining this NG - almost as
> bad as top (or bottom) posting! However, the article seems to suggest
> that if you want all fields, it is better to explicitly name the lot.


"seems to suggest"? I thought it was worded strongly enough that it would do
more than "seem to suggest" ,,, :-)

> Is that right?


Yes

> Does everyone do that?


Everyone who :
a) knows the pitfalls of selstar
b) is not lazy
c) wants to reduce network traffic and the time connected to the database,
resulting in better performance and resource utilization

:-)

Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com