prob with ado reading http://

R

Ron

Hello,

I keep getting a runtime error with the following ado
routine that I run from a VB6 app - note: I tried it with
ref to mdac2.6 and mdac2.7 and mdac2.8. This worked once,
but it doesn't work anymore. I think I changed something,
either in the code or on the system. It crashes at
rs.Open...

mylocattest.txt is a simple text file with one line of
text. I can see it at http://localhost/mylocaltest.txt

Could anyone suggest what the problem might be? Maybe the
wrong args for rs.Open...?

Public Sub HttpData()
Dim Cnxn As ADODB.Connection, strCnxn As String
Dim rs As ADODB.Record, strFile As String

Set rs = New ADODB.Record
Set Cnxn = New ADODB.Connection
'strCnxn = "url=http://localhost/"
strCnxn = "url=http://myServerName/"
Cnxn.Open strCnxn
strFile = "mylocaltest.txt"
rs.Open strFile, Cnxn, adModeRead, adOpenIfExists
'rcFile.Open "http://cnfrkccmc001/mylocaltest.txt", ,
adModeRead, adOpenIfExists
rs.Close
Cnxn.Close
End Sub

Thanks,
Ron
 
B

Bob Barrows [MVP]

Ron said:
Hello,

I keep getting a runtime error with the following ado
routine that I run from a VB6 app - note: I tried it with
ref to mdac2.6 and mdac2.7 and mdac2.8. This worked once,
but it doesn't work anymore. I think I changed something,
either in the code or on the system. It crashes at
rs.Open...

Define "crashes". Error messages? We're not looking over your shoulder while
you're testing ...
mylocattest.txt is a simple text file with one line of
text. I can see it at http://localhost/mylocaltest.txt

Could anyone suggest what the problem might be? Maybe the
wrong args for rs.Open...?

Public Sub HttpData()
Dim Cnxn As ADODB.Connection, strCnxn As String
Dim rs As ADODB.Record, strFile As String

Set rs = New ADODB.Record
Set Cnxn = New ADODB.Connection
'strCnxn = "url=http://localhost/"
strCnxn = "url=http://myServerName/"
Cnxn.Open strCnxn
strFile = "mylocaltest.txt"
rs.Open strFile, Cnxn, adModeRead, adOpenIfExists
'rcFile.Open "http://cnfrkccmc001/mylocaltest.txt", ,
adModeRead, adOpenIfExists

Where did you find that adOpenIfExists constant? I see no reference to it in
any documentation I can find. See for yourself:
http://msdn.microsoft.com/library/en-us/ado270/htm/mdmthrstopen.asp

In fact, that adModeRead constant is not valid in a recordset Open statement
either. That constant is used to set the Mode property of a connection
object, something which cannot be done in a recordset Open statement.

Read the documentation in the link I provided to discover what the valid
constants are.

Bob Barrows
 
R

Ron

Thanks very much for your reply and for the refernce
site. I am checking out your reference site. But I was
emulating an example that I got from

http://msdn.microsoft.com/library/default.asp?
url=/library/en-us/ado270/htm/mdmthdeleterecordvbx.asp

Also, for the constants that I used in my sample routine,
I picked the constant(s) from the dropdown box that
followed each comma. These constants probably apply to an
ADODB.Record object which is what I dimmed rs as -
ADODB.Record. I tried changing it to ADODB.Recordset, but
still no luck. My sample worked once. I left it for a
few days, came back to it, and no longer working. I will
keep studying your reference site and hopefully a light
will come on. But if you could see what would make my
sample work (what the correct constants would be) may I
request your enlightenment?

Regards,
Ron
 
B

Bob Barrows [MVP]

I missed the fact that you were attempting to use a Record rather than a
Recordset. The link I provided is not relevant

I'm going to reiterate my request for further details about what you mean by
"crash". I'm also going to suggest posting to a VB group rather than an ASP
group. It's fairly well off-topic here.
 
R

Ron

Yes. I did think about off topic. But I was also was
thinking http://... so I thought an asp group might be a
place where someone had done this before. Anyway, I thank
you again for your replies. Now I don't feel so bad
because my problem appears to be not as simple (as I was
hoping it would be).

As for crashing, I mean I get a debug error - one of those
meaningless ones - at the rs.Open... line. I had it
working once, then I left it for a few days, something on
IIS or IE maybe changed when I loaded mdac2.8 (I loaded
mdac2.8 on the iterim), who knows what, now the code
doens't run. then I started tweaking the code - to no
avail. Well, I will try a vb group as you suggest.
 

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

Similar Threads

ADO Recordset Save as XML error 0
ADO Recordset Save as XML error 0
ado properties / parameters 7
ADO paging 1
ADO, Python and MS Exchange 0
ADO 0
login prob 2
Running an SQL stored procedure with ADO 4

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top