prob with ado reading http://

Discussion in 'ASP General' started by Ron, Mar 24, 2005.

  1. Ron

    Ron Guest

    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
     
    Ron, Mar 24, 2005
    #1
    1. Advertising

  2. Ron wrote:
    > 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


    --
    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], Mar 24, 2005
    #2
    1. Advertising

  3. Ron

    Ron Guest

    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

    >-----Original Message-----
    >Ron wrote:
    >> 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
    >
    >
    >--
    >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.
    >
    >
    >.
    >
     
    Ron, Mar 24, 2005
    #3
  4. 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.

    Ron wrote:
    > 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
    >
    >> -----Original Message-----
    >> Ron wrote:
    >>> 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

    >>


    --
    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], Mar 24, 2005
    #4
  5. Ron

    Ron Guest

    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.

    >-----Original Message-----
    >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.
    >
    >Ron wrote:
    >> 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
    >>
    >>> -----Original Message-----
    >>> Ron wrote:
    >>>> 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
    >>>

    >
    >--
    >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.
    >
    >
    >.
    >
     
    Ron, Mar 24, 2005
    #5
    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. nita
    Replies:
    1
    Views:
    879
    Saravana
    Nov 20, 2004
  2. ronaldlee

    Transfer ADO Code to ADO.NET

    ronaldlee, Dec 17, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    466
    Kevin Spencer
    Dec 17, 2004
  3. Replies:
    0
    Views:
    1,320
  4. =?Utf-8?B?bGFuZW0=?=

    Reading an excel spreadsheet using ado.net

    =?Utf-8?B?bGFuZW0=?=, Jun 21, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    750
    Mark Rae
    Jun 21, 2006
  5. Navin
    Replies:
    1
    Views:
    705
    Ken Schaefer
    Sep 9, 2003
Loading...

Share This Page