If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > opening url in a recordset

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-25-03, 02:13
rahulqa rahulqa is offline
Registered User
 
Join Date: Feb 2003
Posts: 18
Arrow opening url in a recordset

I have two file a.asp and b.rst. Both the files residing on same server. The file b.rst contains the records from database.
I want to open the b.rst file using recordset object. For that i wrote the following code in a.asp file.
<%set rs=server.createobject("ADODB.recordset")
rs.open "http://www.myserver.com/b.rst"
while not rs.EOF
response.write(rs("id") & "&nbsp;" & rs("name") & "<br>")
rs.MoveNext
wend
%>
This works fine. But it gives error when the two files are on different server.
Can I open the b.rst file if it is on different server than a.asp

I mean can we access a file residing on different server using a file on another server using the above code or any changes are needed in the above code or it is not possible at all?

Thanks
Rahul
Reply With Quote
  #2 (permalink)  
Old 02-26-03, 15:56
pjames pjames is offline
Registered User
 
Join Date: Jan 2003
Posts: 23
Re: opening url in a recordset

I'm not sure why you would ever want to do this i assume you are using a db that does not support outside access. sounds like a IWAM account issue. please post the code on both pages so we can review.
Reply With Quote
  #3 (permalink)  
Old 02-27-03, 04:15
rahulqa rahulqa is offline
Registered User
 
Join Date: Feb 2003
Posts: 18
This is the first file which captures all the records from database table into the a .rst file. This is hosted on one server.
<%set con=server.createobject("ADODB.connection")
con.open "DSN=dsnname;UID=uid;PWD=pwd;"
set rs=server.createobject("ADODB.recordset")
rs.cursorlocation=adUseClient
rs.cursorType=adOpenStatic
rs.LockType=adLockBatchOptimistic
rs.open "select * from myTable" , con
rs.save "c:/try/myfile.rst", adPersistXML
set rs = nothing
%>

The second file hosted on different server accesses all the records from the .rst file and displays them.
<%set rs=server.createobject("ADODB.recordset")
rs.open "c:/try/myfile.rst"
'For web address it will be
'rs.open "http://www.myfirstserver.com"
while not rs.EOF
response.write(rs("id") & "&nbsp;" & rs("name") & "<br>")
rs.MoveNext
wend
%>


I know accessing the data from different server is possible through xml but this method works when both files are on same server.
Problem arises only for two different servers.
Reply With Quote
  #4 (permalink)  
Old 02-27-03, 05:59
Bunce Bunce is offline
Registered User
 
Join Date: Jul 2002
Location: Australia
Posts: 147
You can't *open* a recordset from another file. You have to actually run that file itself. Once it finishes running, the recordset doesn't exist anymore.

The only thing you could try would be to Server.Execute the file which is basically a way of including the file.

Cheers,
Andrew
__________________
There have been many posts made throughout the world.
This was one of them.
Reply With Quote
  #5 (permalink)  
Old 02-27-03, 12:23
pjames pjames is offline
Registered User
 
Join Date: Jan 2003
Posts: 23
You are missing the point andrew he is saving it in a parseable file. Not returning the connection or record set. the rst file does not contain the connection or recordset it contains the product of calling the file.
Reply With Quote
  #6 (permalink)  
Old 02-27-03, 12:27
pjames pjames is offline
Registered User
 
Join Date: Jan 2003
Posts: 23
Is the location of that file a local share? you would have to give everyone complete acces of the file in order for the server to see it also you would not want to use a https:// the ip and file share name is what you would want to pass. This mabye off the subject but the results you are looking for might be easly resolved with a web service.
Reply With Quote
  #7 (permalink)  
Old 02-28-03, 04:24
rahulqa rahulqa is offline
Registered User
 
Join Date: Feb 2003
Posts: 18
Ok. I think sharing may be problem. That file may not have proper sharing given, so it is not running from another server.

Thanks to all for your help.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On