Passing Recordset from an ASP page to another HTML page ?

O

Oscar

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
 
M

McKirahan

Oscar said:
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).
 
M

McKirahan

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

[ 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?
 
B

Bob Barrows [MVP]

Oscar said:
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
 
O

Oscar

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 said:
Oscar said:
Hi McKirahan,
no way to pass the recordset directly like an argument of a page ?

[ 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?
 
O

Oscar

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
 
M

McKirahan

Oscar said:
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.
 
B

Brian Staff

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 said:
Oscar said:
Hi McKirahan,
no way to pass the recordset directly like an argument of a page ?

[ 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?
 
A

Adrienne

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.
 
B

Bob Barrows [MVP]

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 said:
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
 
B

Bob Barrows [MVP]

Oscar said:
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
 
S

Stefan Berglund

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

Bob Barrows [MVP]

Stefan said:
On Mon, 30 May 2005 10:08:35 -0400, "Bob Barrows [MVP]"


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
 
S

Stefan Berglund

in said:
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.
 
B

Bob Barrows [MVP]

Stefan said:
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
 
S

Stefan Berglund

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

Bob Barrows [MVP]

Stefan said:
On Mon, 30 May 2005 18:59:17 -0400, "Bob Barrows [MVP]"



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
 
B

Bob Barrows [MVP]

Stefan said:
On Mon, 30 May 2005 18:59:17 -0400, "Bob Barrows [MVP]"



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
 
S

Stefan Berglund

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

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top