Creating sub-recordsets

Discussion in 'ASP General' started by Giles, Jun 5, 2005.

  1. Giles

    Giles Guest

    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, Jun 5, 2005
    #1
    1. Advertising

  2. Giles

    Bob Lehmann Guest

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

    Bob Lehmann

    "Giles" <> wrote in message
    news:...
    > 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, Jun 5, 2005
    #2
    1. Advertising

  3. Giles

    Giles Guest

    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

    >"Bob Lehmann" wrote > Why don't you just run the second statement to begin
    >with?
    >
    > "Giles" wrote in message
    >> 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
    Giles, Jun 5, 2005
    #3
  4. 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"
    Bob Barrows [MVP], Jun 5, 2005
    #4
  5. Giles

    Giles Guest

    "Bob Barrows [MVP]" wrote
    > 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


    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
    Giles, Jun 6, 2005
    #5
  6. Giles wrote:
    > "Bob Barrows [MVP]" wrote
    >> 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

    >
    > 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"
    Bob Barrows [MVP], Jun 6, 2005
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. AFN
    Replies:
    5
    Views:
    400
    dilipdotnet at apdiya.com
    Feb 11, 2004
  2. Sky
    Replies:
    2
    Views:
    354
  3. Working with recordsets

    , Jan 7, 2005, in forum: Python
    Replies:
    2
    Views:
    265
    Steve Holden
    Jan 8, 2005
  4. Ben
    Replies:
    2
    Views:
    860
  5. Lawrence D'Oliveiro

    Death To Sub-Sub-Sub-Directories!

    Lawrence D'Oliveiro, May 5, 2011, in forum: Java
    Replies:
    92
    Views:
    1,965
    Lawrence D'Oliveiro
    May 20, 2011
Loading...

Share This Page