Passing Recordset from an ASP page to another HTML page ?

Discussion in 'ASP General' started by Oscar, May 27, 2005.

  1. Oscar

    Oscar Guest

    I am looking for a way to pass an ADO recordset that has been retrieved in
    an ASP page to another HTML-page. Is there someone who can provide me with a
    small sample or a link to see how this is done?

    regards,
    Oscar
     
    Oscar, May 27, 2005
    #1
    1. Advertising

  2. Oscar

    McKirahan Guest

    "Oscar" <> wrote in message
    news:...
    > I am looking for a way to pass an ADO recordset that has been retrieved in
    > an ASP page to another HTML-page. Is there someone who can provide me with

    a
    > small sample or a link to see how this is done?
    >
    > regards,
    > Oscar
    >

    You could use ADO's ReadAll() and pass the result
    (depending on how big the recordset is).
     
    McKirahan, May 27, 2005
    #2
    1. Advertising

  3. Oscar

    Oscar Guest

    Hi McKirahan,
    no way to pass the recordset directly like an argument of a page ?


    "McKirahan" <> schreef in bericht
    news:...
    > "Oscar" <> wrote in message
    > news:...
    >> I am looking for a way to pass an ADO recordset that has been retrieved
    >> in
    >> an ASP page to another HTML-page. Is there someone who can provide me
    >> with

    > a
    >> small sample or a link to see how this is done?
    >>
    >> regards,
    >> Oscar
    >>

    > You could use ADO's ReadAll() and pass the result
    > (depending on how big the recordset is).
    >
    >
     
    Oscar, May 27, 2005
    #3
  4. Oscar

    McKirahan Guest

    "Oscar" <> wrote in message
    news:...
    > Hi McKirahan,
    > no way to pass the recordset directly like an argument of a page ?
    >
    >
    > "McKirahan" <> schreef in bericht
    > news:...
    > > "Oscar" <> wrote in message
    > > news:...
    > >> I am looking for a way to pass an ADO recordset that has been retrieved
    > >> in
    > >> an ASP page to another HTML-page. Is there someone who can provide me
    > >> with

    > > a
    > >> small sample or a link to see how this is done?
    > >>
    > >> regards,
    > >> Oscar
    > >>

    > > You could use ADO's ReadAll() and pass the result
    > > (depending on how big the recordset is).
    > >


    [ Please don't top post. ]

    Via QueryString and name/value pairs?

    How much data is in the record set?
    WIll the total length exceed 1,000 characters?
     
    McKirahan, May 28, 2005
    #4
  5. Oscar wrote:
    > I am looking for a way to pass an ADO recordset that has been
    > retrieved in an ASP page to another HTML-page. Is there someone who
    > can provide me with a small sample or a link to see how this is done?
    >
    > regards,
    > Oscar

    Probably a variation on this theme:
    http://www.davidpenton.com/testsite/tips/xml.recordset.server2client.asp

    or the technique used in the dynamic listbox demo available here:
    http://www.thrasherwebdesign.com/index.asp?pi=links&hp=links.asp&c=&a=clear

    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], May 28, 2005
    #5
  6. Oscar

    Oscar Guest

    Most of the time it will count up to 200-300 characters.

    In a very few cases it might exceed 1000 characters.

    regards,
    Oscar


    "McKirahan" <> schreef in bericht
    news:...
    > "Oscar" <> wrote in message
    > news:...
    >> Hi McKirahan,
    >> no way to pass the recordset directly like an argument of a page ?
    >>
    >>
    >> "McKirahan" <> schreef in bericht
    >> news:...
    >> > "Oscar" <> wrote in message
    >> > news:...
    >> >> I am looking for a way to pass an ADO recordset that has been
    >> >> retrieved
    >> >> in
    >> >> an ASP page to another HTML-page. Is there someone who can provide me
    >> >> with
    >> > a
    >> >> small sample or a link to see how this is done?
    >> >>
    >> >> regards,
    >> >> Oscar
    >> >>
    >> > You could use ADO's ReadAll() and pass the result
    >> > (depending on how big the recordset is).
    >> >

    >
    > [ Please don't top post. ]
    >
    > Via QueryString and name/value pairs?
    >
    > How much data is in the record set?
    > WIll the total length exceed 1,000 characters?
    >
    >
     
    Oscar, May 28, 2005
    #6
  7. Oscar

    Oscar Guest

    Thanks for the links Bob.

    I will study both ways to pass recordset although I did't expect to use XML
    for passing the recordset.

    I couldn't get the dynamic listbox example running. As I call the client
    page a VBScript error warning that it needs a spacing character at row 55 :
    <!doctype HTML public.....> is reported.

    Oscar



    "Bob Barrows [MVP]" <> schreef in bericht
    news:%...
    > Oscar wrote:
    >> I am looking for a way to pass an ADO recordset that has been
    >> retrieved in an ASP page to another HTML-page. Is there someone who
    >> can provide me with a small sample or a link to see how this is done?
    >>
    >> regards,
    >> Oscar

    > Probably a variation on this theme:
    > http://www.davidpenton.com/testsite/tips/xml.recordset.server2client.asp
    >
    > or the technique used in the dynamic listbox demo available here:
    > http://www.thrasherwebdesign.com/index.asp?pi=links&hp=links.asp&c=&a=clear
    >
    > 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"
    >
     
    Oscar, May 28, 2005
    #7
  8. Oscar

    McKirahan Guest

    "Oscar" <> wrote in message
    news:#...
    > Most of the time it will count up to 200-300 characters.
    >
    > In a very few cases it might exceed 1000 characters.
    >
    > regards,
    > Oscar


    [snip]

    AFAIK QueryString 's limit is about 1,024 bytes.
    Some characters will take 3 bytes; e.g. Space = %20.

    More details about your problem may prove helpful.
     
    McKirahan, May 28, 2005
    #8
  9. Oscar

    Brian Staff Guest

    Why not top post? It seems eminently more efficient to me in that it
    eliminates having to scroll down on every post. Can you give me one good
    reason?

    Brian
    "McKirahan" <> wrote in message
    news:...
    > "Oscar" <> wrote in message
    > news:...
    >> Hi McKirahan,
    >> no way to pass the recordset directly like an argument of a page ?
    >>
    >>
    >> "McKirahan" <> schreef in bericht
    >> news:...
    >> > "Oscar" <> wrote in message
    >> > news:...
    >> >> I am looking for a way to pass an ADO recordset that has been
    >> >> retrieved
    >> >> in
    >> >> an ASP page to another HTML-page. Is there someone who can provide me
    >> >> with
    >> > a
    >> >> small sample or a link to see how this is done?
    >> >>
    >> >> regards,
    >> >> Oscar
    >> >>
    >> > You could use ADO's ReadAll() and pass the result
    >> > (depending on how big the recordset is).
    >> >

    >
    > [ Please don't top post. ]
    >
    > Via QueryString and name/value pairs?
    >
    > How much data is in the record set?
    > WIll the total length exceed 1,000 characters?
    >
    >
     
    Brian Staff, May 30, 2005
    #9
  10. Oscar

    Adrienne Guest

    Gazing into my crystal ball I observed "Brian Staff" <>
    writing in news:Ghvme.7096$vp.2713@fed1read07:

    > Why not top post? It seems eminently more efficient to me in that it
    > eliminates having to scroll down on every post. Can you give me one good
    > reason?
    >
    >


    Google for Top Bottom Posting. You will be rewarded with a plethora of
    reasons.

    --
    Adrienne Boswell
    http://www.cavalcade-of-coding.info
    Please respond to the group so others can share
     
    Adrienne, May 30, 2005
    #10
  11. You've made three points that need replies in your message. Top-posting
    makes it very awkward to reply to these points. Interspersed replies make
    the points being answered obvious. See below:

    Brian Staff wrote:
    > Why not top post?


    Because it makes it harder to specify which point in the OP is being
    answered. The style of quoting I am using makes it obvious that I am
    answering your first question.

    > It seems eminently more efficient to me in that it
    > eliminates having to scroll down on every post.


    Snipping should be done, no matter which style of quoting is being used. I
    will concede that lazy bottom-posters who don't adequately snip are just as
    bad as top posters who don't snip.
    Also, if you (the reader) need to refer to the original post while reading
    the reply, you will do a lot more scrolling than you would if the replies
    were interspersed.

    > Can you give me one
    > good reason?


    I think the above covers this request. However, another reason is that
    bottom posting (or better yet, interspersed) allows sigs to work correctly.
    The sig should be the last item in a post, because most news readers will
    treat everything appearing after the sig token (--) as a signature, either
    snipping it in some cases, or graying it out in others. So if you top-post
    and put your sig immediately after your reply, the text you are quoting (or
    failing to snip) will be treated as if it was part of your sig. So, if you
    solve that by moving your sig to the bottom of the post (leaving your reply
    at the top), your sig is unlikely to be read. Of course, if you don't care
    if anyone reads your sig, this won't bother you, but ...

    <snip>

    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], May 30, 2005
    #11
  12. Oscar wrote:
    > Thanks for the links Bob.
    >
    > I will study both ways to pass recordset although I did't expect to
    > use XML for passing the recordset.


    It's pretty much the best/only way to pass a recordset to the client. Of
    course, if you only wnat the data, and you don't need the recordset itself,
    you can pass an array easily enough. Just put the data into an array, use
    Join to merge the array elements into a string, pass the string, and use
    Split to recreate the original array.

    >
    > I couldn't get the dynamic listbox example running. As I call the
    > client page a VBScript error warning that it needs a spacing
    > character at row 55 : <!doctype HTML public.....> is reported.
    >


    That does not happen to me. Your browser/firewall/anti-virus/popup blocker
    must be inserting extra html. You will have to troubleshoot this yourself.

    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], May 30, 2005
    #12
  13. On Mon, 30 May 2005 10:08:35 -0400, "Bob Barrows [MVP]"
    <> wrote:
    in <#>

    >Oscar wrote:
    >> Thanks for the links Bob.
    >>
    >> I will study both ways to pass recordset although I did't expect to
    >> use XML for passing the recordset.

    >
    >It's pretty much the best/only way to pass a recordset to the client. Of
    >course, if you only wnat the data, and you don't need the recordset itself,
    >you can pass an array easily enough. Just put the data into an array, use
    >Join to merge the array elements into a string, pass the string, and use
    >Split to recreate the original array.


    I prefer to pass it through the Response object itself where it streams
    in binary and requires half or less of the bandwidth that XML does.


    ---
    Stefan Berglund
     
    Stefan Berglund, May 30, 2005
    #13
  14. Stefan Berglund wrote:
    > On Mon, 30 May 2005 10:08:35 -0400, "Bob Barrows [MVP]"
    > <> wrote:
    > in <#>
    >
    >> Oscar wrote:
    >>> Thanks for the links Bob.
    >>>
    >>> I will study both ways to pass recordset although I did't expect to
    >>> use XML for passing the recordset.

    >>
    >> It's pretty much the best/only way to pass a recordset to the
    >> client. Of course, if you only wnat the data, and you don't need the
    >> recordset itself, you can pass an array easily enough. Just put the
    >> data into an array, use Join to merge the array elements into a
    >> string, pass the string, and use Split to recreate the original
    >> array.

    >
    > I prefer to pass it through the Response object itself where it
    > streams
    > in binary and requires half or less of the bandwidth that XML does.
    >


    Could you provide a quick example?

    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], May 30, 2005
    #14
  15. On Mon, 30 May 2005 17:56:52 -0400, "Bob Barrows [MVP]" <> wrote:
    in <>

    >Stefan Berglund wrote:
    >> On Mon, 30 May 2005 10:08:35 -0400, "Bob Barrows [MVP]"
    >> <> wrote:
    >> in <#>
    >>
    >>> Oscar wrote:
    >>>> Thanks for the links Bob.
    >>>>
    >>>> I will study both ways to pass recordset although I did't expect to
    >>>> use XML for passing the recordset.
    >>>
    >>> It's pretty much the best/only way to pass a recordset to the
    >>> client. Of course, if you only wnat the data, and you don't need the
    >>> recordset itself, you can pass an array easily enough. Just put the
    >>> data into an array, use Join to merge the array elements into a
    >>> string, pass the string, and use Split to recreate the original
    >>> array.

    >>
    >> I prefer to pass it through the Response object itself where it
    >> streams
    >> in binary and requires half or less of the bandwidth that XML does.
    >>

    >
    >Could you provide a quick example?
    >
    >Bob Barrows


    Certainly, except that I just realized that the subject specified an HTML
    page as the recipient. I responded to your statement that it was ~pretty
    much the best/only way to pass a recordset to the client~ so this method
    may not work to another HTML page although I think it should be possible.

    ASP (no HTML) My connection object is set in my includes which are not
    included, but all the rest is from your examples so I'm sure you know what
    to do here. <g>

    <%Option Explicit
    Dim rs: Set rs = cn.Execute("get_Entries " & some parameters)
    rs.Save Response: rs.Close: Set rs = Nothing: cn.Close: Set cn = Nothing%>

    Your Client Side VB app: (note no connection object required here)
    Dim rs As ADODB.Recordset: Set rs = New ADODB.Recordset
    rs.Open "http://www.URL_of_above_asp_page.asp"
    Dim ar: If (Not rs.EOF) Then ar = rs.GetRows
    blah blah blah

    The data streams through the Response object and probably should be
    encrypted when necessary.


    ---
    Stefan Berglund
     
    Stefan Berglund, May 30, 2005
    #15
  16. Stefan Berglund wrote:
    >>>
    >>> I prefer to pass it through the Response object itself where it
    >>> streams
    >>> in binary and requires half or less of the bandwidth that XML does.
    >>>

    >>
    >> Could you provide a quick example?
    >>
    >> Bob Barrows

    >
    > Certainly, except that I just realized that the subject specified an
    > HTML
    > page as the recipient. I responded to your statement that it was
    > ~pretty
    > much the best/only way to pass a recordset to the client~ so this
    > method
    > may not work to another HTML page although I think it should be
    > possible.
    >


    Ah, that clears things up.

    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], May 30, 2005
    #16
  17. On Mon, 30 May 2005 18:59:17 -0400, "Bob Barrows [MVP]"
    <> wrote:
    in <>

    >Stefan Berglund wrote:
    >>>>
    >>>> I prefer to pass it through the Response object itself where it
    >>>> streams
    >>>> in binary and requires half or less of the bandwidth that XML does.
    >>>>
    >>>
    >>> Could you provide a quick example?
    >>>
    >>> Bob Barrows

    >>
    >> Certainly, except that I just realized that the subject specified an
    >> HTML
    >> page as the recipient. I responded to your statement that it was
    >> ~pretty
    >> much the best/only way to pass a recordset to the client~ so this
    >> method
    >> may not work to another HTML page although I think it should be
    >> possible.
    >>

    >
    >Ah, that clears things up.
    >
    >Bob Barrows



    Does it? Could you explain why it doesn't work based on the MSDN docs?

    mk:mad:MSITStore:G:\MSDN\ado270.chm::/htm/mdmthrstopen.htm

    Sure looks like it should work for another ASP page (URL) but I couldn't
    make it work.


    ---
    Stefan Berglund
     
    Stefan Berglund, May 31, 2005
    #17
  18. Stefan Berglund wrote:
    > On Mon, 30 May 2005 18:59:17 -0400, "Bob Barrows [MVP]"
    > <> wrote:
    > in <>
    >
    >> Stefan Berglund wrote:
    >>>>>
    >>>>> I prefer to pass it through the Response object itself where it
    >>>>> streams
    >>>>> in binary and requires half or less of the bandwidth that XML
    >>>>> does.
    >>>>>
    >>>>
    >>>> Could you provide a quick example?
    >>>>
    >>>> Bob Barrows
    >>>
    >>> Certainly, except that I just realized that the subject specified an
    >>> HTML
    >>> page as the recipient. I responded to your statement that it was
    >>> ~pretty
    >>> much the best/only way to pass a recordset to the client~ so this
    >>> method
    >>> may not work to another HTML page although I think it should be
    >>> possible.
    >>>

    >>
    >> Ah, that clears things up.
    >>
    >> Bob Barrows

    >
    >
    > Does it? Could you explain why it doesn't work based on the MSDN
    > docs?
    >
    > mk:mad:MSITStore:G:\MSDN\ado270.chm::/htm/mdmthrstopen.htm
    >
    > Sure looks like it should work for another ASP page (URL) but I
    > couldn't make it work.
    >
    >

    I thought it would work. Do you get an error? Could we see the code that
    produces the error?

    I've never tried utilizing that functionality (using a url in the open
    statement). Perhaps you are running into some security issues.

    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], May 31, 2005
    #18
  19. Stefan Berglund wrote:
    > On Mon, 30 May 2005 18:59:17 -0400, "Bob Barrows [MVP]"
    > <> wrote:
    > in <>
    >
    >> Stefan Berglund wrote:
    >>>>>
    >>>>> I prefer to pass it through the Response object itself where it
    >>>>> streams
    >>>>> in binary and requires half or less of the bandwidth that XML
    >>>>> does.
    >>>>>
    >>>>
    >>>> Could you provide a quick example?
    >>>>
    >>>> Bob Barrows
    >>>
    >>> Certainly, except that I just realized that the subject specified an
    >>> HTML
    >>> page as the recipient. I responded to your statement that it was
    >>> ~pretty
    >>> much the best/only way to pass a recordset to the client~ so this
    >>> method
    >>> may not work to another HTML page although I think it should be
    >>> possible.
    >>>

    >>
    >> Ah, that clears things up.
    >>
    >> Bob Barrows

    >
    >
    > Does it? Could you explain why it doesn't work based on the MSDN
    > docs?
    >
    > mk:mad:MSITStore:G:\MSDN\ado270.chm::/htm/mdmthrstopen.htm
    >
    > Sure looks like it should work for another ASP page (URL) but I
    > couldn't make it work.
    >
    >


    I've got it working (this example is IE only):

    ReturnRecordset.asp:
    <%
    dim cn, rs, sSQL

    set cn = server.CreateObject("ADODB.Connection")
    cn.Open "provider=sqloledb;data source=clnsqldev7;" & _
    "user id = xxxx;password=xxxx"

    sSQL = "Select CompanyName,ContactName,City " & _
    "FROM Northwind..Suppliers"

    set rs = createobject("adodb.recordset")
    rs.CursorLocation=3
    rs.Open sSQL,cn
    set rs.ActiveConnection=nothing
    cn.Close:set cn=nothing
    rs.Save Response
    rs.close:set rs=nothing
    %>

    RetrieveRecordset.htm:
    <HTML>
    <BODY>
    <SCRIPT LANGUAGE=vbscript>
    dim rs
    set rs=createobject("adodb.recordset")
    rs.Open "http://barrowbo/test_Local/ReturnRecordset.asp", _
    "Provider=MSPersist;"
    document.write rs.GetString(,," | ","<BR>")
    rs.Close
    set rs=nothing
    </SCRIPT>
    </BODY>
    </HTML>

    Even though I have made the decision to avoid using ADO on the client (due
    to version, installation and incompatability issues), this is pretty cool.
    It would probably be more useful in a VB client than a browser client.

    Bob Barrows

    --
    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], May 31, 2005
    #19
  20. On Tue, 31 May 2005 10:08:34 -0400, "Bob Barrows [MVP]"
    <> wrote:
    in <>


    >
    >I've got it working (this example is IE only):
    >
    >ReturnRecordset.asp:
    ><%
    >dim cn, rs, sSQL
    >
    >set cn = server.CreateObject("ADODB.Connection")
    >cn.Open "provider=sqloledb;data source=clnsqldev7;" & _
    >"user id = xxxx;password=xxxx"
    >
    >sSQL = "Select CompanyName,ContactName,City " & _
    >"FROM Northwind..Suppliers"
    >
    >set rs = createobject("adodb.recordset")
    >rs.CursorLocation=3
    >rs.Open sSQL,cn
    >set rs.ActiveConnection=nothing
    >cn.Close:set cn=nothing
    >rs.Save Response
    >rs.close:set rs=nothing
    >%>
    >
    >RetrieveRecordset.htm:
    ><HTML>
    ><BODY>
    ><SCRIPT LANGUAGE=vbscript>
    >dim rs
    >set rs=createobject("adodb.recordset")
    >rs.Open "http://barrowbo/test_Local/ReturnRecordset.asp", _
    >"Provider=MSPersist;"
    >document.write rs.GetString(,," | ","<BR>")
    >rs.Close
    >set rs=nothing
    ></SCRIPT>
    ></BODY>
    ></HTML>
    >
    >Even though I have made the decision to avoid using ADO on the client (due
    >to version, installation and incompatability issues), this is pretty cool.
    >It would probably be more useful in a VB client than a browser client.
    >
    >Bob Barrows


    Cool. I burned an hour yesterday trying to make it work to another
    page. Yeah, I use this method exclusively in my VB clients when
    retrieving web based SQL data.


    ---
    Stefan Berglund
     
    Stefan Berglund, May 31, 2005
    #20
    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. Robert Cohen
    Replies:
    3
    Views:
    303
    Andrew Durstewitz
    Jul 15, 2003
  2. Hung Huynh
    Replies:
    8
    Views:
    347
    Bob Barrows
    Sep 24, 2003
  3. Johan Lachonius

    Calling from ASP to .NET passing Recordset

    Johan Lachonius, Nov 18, 2003, in forum: ASP General
    Replies:
    0
    Views:
    104
    Johan Lachonius
    Nov 18, 2003
  4. Rob Meade

    Another recordset question

    Rob Meade, Mar 1, 2004, in forum: ASP General
    Replies:
    2
    Views:
    112
    Rob Meade
    Mar 1, 2004
  5. djjohnst
    Replies:
    6
    Views:
    179
    djjohnst
    May 14, 2007
Loading...

Share This Page