Recordset!

Discussion in 'ASP General' started by Arpan, Oct 17, 2005.

  1. Arpan

    Arpan Guest

    Assume that an ASP page has 3 SQL queries. Can a recordset object be
    populated with the records of all these 3 queries at the same time?

    Please note that the 3 queries are distinct queries, not related to
    each other in any way. Also please note that I am not talking about
    populating the recordset with the records of the 1st query, then
    closing it & again opening that recordset, populating it with the
    records of the 2nd query so on & so forth.

    Thanks,

    Arpan
     
    Arpan, Oct 17, 2005
    #1
    1. Advertising

  2. Arpan

    Bullschmidt Guest

    Sure if all the fields are of exactly the same type in each part.

    Union
    http://www.w3schools.com/sql/sql_union.asp

    Best regards,
    J. Paul Schmidt, Freelance Web and Database Developer
    http://www.Bullschmidt.com
    Access Database Sample, Web Database Sample, ASP Design Tips

    <<
    Assume that an ASP page has 3 SQL queries. Can a recordset object be
    populated with the records of all these 3 queries at the same time?

    Please note that the 3 queries are distinct queries, not related to each
    other in any way. Also please note that I am not talking about
    populating the recordset with the records of the 1st query, then closing
    it & again opening that recordset, populating it with the records of the
    2nd query so on & so forth.
    >>


    *** Sent via Developersdex http://www.developersdex.com ***
     
    Bullschmidt, Oct 17, 2005
    #2
    1. Advertising

  3. Not really.* Are they coming from the same database? You could union the
    queries on the database server.

    Ray at work

    * Yes, actually you can if you really want to, but why on Earth...?


    "Arpan" <> wrote in message
    news:...
    > Assume that an ASP page has 3 SQL queries. Can a recordset object be
    > populated with the records of all these 3 queries at the same time?
    >
    > Please note that the 3 queries are distinct queries, not related to
    > each other in any way. Also please note that I am not talking about
    > populating the recordset with the records of the 1st query, then
    > closing it & again opening that recordset, populating it with the
    > records of the 2nd query so on & so forth.
    >
    > Thanks,
    >
    > Arpan
    >
     
    Ray Costanzo [MVP], Oct 17, 2005
    #3
  4. Arpan

    AlanM Guest

    No not if they are not related

    but simply use 3 recordsets


    "Arpan" <> wrote in message
    news:...
    > Assume that an ASP page has 3 SQL queries. Can a recordset object be
    > populated with the records of all these 3 queries at the same time?
    >
    > Please note that the 3 queries are distinct queries, not related to
    > each other in any way. Also please note that I am not talking about
    > populating the recordset with the records of the 1st query, then
    > closing it & again opening that recordset, populating it with the
    > records of the 2nd query so on & so forth.
    >
    > Thanks,
    >
    > Arpan
    >
     
    AlanM, Oct 18, 2005
    #4
  5. Arpan

    Prabhat Guest

    "Arpan" <> wrote in message
    news:...
    > Assume that an ASP page has 3 SQL queries. Can a recordset object be
    > populated with the records of all these 3 queries at the same time?
    >
    > Please note that the 3 queries are distinct queries, not related to
    > each other in any way. Also please note that I am not talking about
    > populating the recordset with the records of the 1st query, then
    > closing it & again opening that recordset, populating it with the
    > records of the 2nd query so on & so forth.
    >
    > Thanks,
    >
    > Arpan


    Hi Arpan,

    I think you have 3 Different SQL Query and dont want to use 3 recordset but
    you want to open / populate ONLY ONE recordset that consistes of all 3 SQL
    Query?

    If that is the case then use NextRecordset method of ADO. Let me know if
    this help.

    Thanks
    Prabhat
     
    Prabhat, Oct 18, 2005
    #5
  6. Prabhat wrote:
    > "Arpan" <> wrote in message
    > news:...
    >> Assume that an ASP page has 3 SQL queries. Can a recordset object be
    >> populated with the records of all these 3 queries at the same time?
    >>
    >> Please note that the 3 queries are distinct queries, not related to
    >> each other in any way. Also please note that I am not talking about
    >> populating the recordset with the records of the 1st query, then
    >> closing it & again opening that recordset, populating it with the
    >> records of the 2nd query so on & so forth.
    >>
    >> Thanks,
    >>
    >> Arpan

    >
    > Hi Arpan,
    >
    > I think you have 3 Different SQL Query and dont want to use 3
    > recordset but you want to open / populate ONLY ONE recordset that
    > consistes of all 3 SQL Query?
    >
    > If that is the case then use NextRecordset method of ADO. Let me know
    > if this help.
    >

    THis will not work with Access, which does not support batch queries. Of
    course, since we don't know what database is being used ...

    Arpan, please. Always specify the database type and version you are using in
    EVERYdatabase-related post you make. Do not assume that we will know your
    database by your previous posts:
    a) we may not have read your previous posts
    b) you may be using a database that is different from the one used in your
    previous posts

    You will avoid receiving unusable replies if you remember to do this. Make
    it a header that you copy/paste into each of your questions to the group.

    As Ray mentioned, it may be possible to construct a union query that will
    retrieve your results in a single recordset. However, this will only work if
    the queries are all being run in the same database (Access) or on the same
    server (SQL Server)


    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
     
    Bob Barrows [MVP], Oct 18, 2005
    #6
  7. Arpan

    Danny@Kendal Guest

    "Arpan" <> wrote in message
    news:...
    > Assume that an ASP page has 3 SQL queries. Can a recordset object be
    > populated with the records of all these 3 queries at the same time?
    >
    > Please note that the 3 queries are distinct queries, not related to
    > each other in any way. Also please note that I am not talking about
    > populating the recordset with the records of the 1st query, then
    > closing it & again opening that recordset, populating it with the
    > records of the 2nd query so on & so forth.


    I have three tables for a What's On database - Dates, Classes and Hosts.
    It's a MS Access database and I use ASP with VBScript to generate results
    for a web page.

    Dates is a table of dates with a link to Classes via ClassID.
    Classes contains details of the event with a link to Hosts via HostName.
    Hosts contains details of who is hosting the event.

    If a date is listed then there must be a corresponding event set up. Not
    every event has a host. I use the following SQL query to dump results into a
    single recordset. I'm no expert so make of it what you will. All polite
    criticism appreciated. :)

    SELECT *
    FROM Hosts
    RIGHT JOIN
    (Classes INNER JOIN Dates ON Classes.ClassID=Dates.ClassID)
    ON Hosts.HostName=Classes.HostName
    WHERE (add your filters here)
    AND (add another filter here if you like)
    ORDER BY (sort the results)
     
    Danny@Kendal, Oct 18, 2005
    #7
  8. Arpan

    Prabhat Guest

    "Bob Barrows [MVP]" <> wrote in message
    news:u91st$#...
    >
    > THis will not work with Access, which does not support batch queries. Of
    > course, since we don't know what database is being used ...
    >
    > Arpan, please. Always specify the database type and version you are using

    in
    > EVERYdatabase-related post you make. Do not assume that we will know your
    > database by your previous posts:
    > a) we may not have read your previous posts
    > b) you may be using a database that is different from the one used in your
    > previous posts
    >
    > You will avoid receiving unusable replies if you remember to do this. Make
    > it a header that you copy/paste into each of your questions to the group.
    >
    > As Ray mentioned, it may be possible to construct a union query that will
    > retrieve your results in a single recordset. However, this will only work

    if
    > the queries are all being run in the same database (Access) or on the same
    > server (SQL Server)
    >
    >
    > --
    > Microsoft MVP -- ASP/ASP.NET
    > Please reply to the newsgroup. The email account listed in my From
    > header is my spam trap, so I don't check it very often. You will get a
    > quicker response by posting to the newsgroup.
    >
    >


    Yes that will not work on MS Access.
     
    Prabhat, Oct 18, 2005
    #8
    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. Vikas Yadav
    Replies:
    0
    Views:
    1,141
    Vikas Yadav
    Sep 9, 2003
  2. gary artim

    recordset error/perl messages

    gary artim, Feb 6, 2004, in forum: Perl
    Replies:
    0
    Views:
    501
    gary artim
    Feb 6, 2004
  3. Bob
    Replies:
    0
    Views:
    408
  4. NAIME ESTEVES

    RECORDSET

    NAIME ESTEVES, Jul 10, 2003, in forum: ASP .Net
    Replies:
    4
    Views:
    563
    NAIME ESTEVES
    Jul 11, 2003
  5. Hung Huynh
    Replies:
    8
    Views:
    328
    Bob Barrows
    Sep 24, 2003
Loading...

Share This Page