|
 |
access_asp thread: ADODB.Connection error '800a0bb9' - why?
Message #1 by "Laurence Bier" <lbier@v...> on Sat, 9 Mar 2002 23:30:00
|
|
I get this error using a _very_ basic script to read the field headings
and values in a Access database. I checked the archives of this and other
boards as well as Microsoft support before asking this question. Though it
doesn't use a global.asa file, when I put one in the virtual root it fires
just fine. I have full read/write privileges to the database. To hedge my
bets, I removed any space characters that were in the field headings,
replacing them with underscore characters ("first_name" instead of "first
name") - as I'd read this was a possible source of this error. Still get
the same message. What follows is the script - taken pretty much verbatim
from Wrox's Intro to ASP. And yes, the database is set up for a DSN
connection - a script that runs through the connection properties works
fine.
If you have any ideas, I'd love to hear them.
<%
dim objRS
Set objRS=Server.CreateObject("ADODB.Connection")
dim fldF
objRS.Open "DSN=novascotia12"
For Each fldF In objRS.Fields
Response.Write "Field:" & fldF.Name & "<br>"
Next
While Not objRS.EOF
For Each fldF In objRS.Fields
Response.Write fldF.Value
Next
objRS.MoveNext
Wend
objRS.Close
Set objRS=Nothing
%>
Message #2 by "Ken Schaefer" <ken@a...> on Mon, 11 Mar 2002 10:49:48 +1100
|
|
You are doing this:
: Set objRS=Server.CreateObject("ADODB.Connection")
then you are doing this:
: For Each fldF In objRS.Fields
: Response.Write "Field:" & fldF.Name & "<br>"
: Next
.Fields is not a collection of the ADO Connection object - it is a
collection of the ADO Recordset object.
<%
' First you need to open a connection:
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "DSN=myDSN"
' Now we get a recordset from records in the database
' using the connection we just opened:
strSQL = "SELECT field1 FROM table1"
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open strSQL, objConn
For Each objField in objRS.Fields
Response.Write("Field: " & objField.Name & "<br>")
Next
%>
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To: "Access ASP" <access_asp@p...>
: I get this error using a _very_ basic script to read the field headings
: and values in a Access database. I checked the archives of this and other
: boards as well as Microsoft support before asking this question. Though it
: doesn't use a global.asa file, when I put one in the virtual root it fires
: just fine. I have full read/write privileges to the database. To hedge my
: bets, I removed any space characters that were in the field headings,
: replacing them with underscore characters ("first_name" instead of "first
: name") - as I'd read this was a possible source of this error. Still get
: the same message. What follows is the script - taken pretty much verbatim
: from Wrox's Intro to ASP. And yes, the database is set up for a DSN
: connection - a script that runs through the connection properties works
: fine.
: If you have any ideas, I'd love to hear them.
:
: <%
:
: dim objRS
: Set objRS=Server.CreateObject("ADODB.Connection")
:
: dim fldF
:
: objRS.Open "DSN=novascotia12"
:
: For Each fldF In objRS.Fields
: Response.Write "Field:" & fldF.Name & "<br>"
: Next
:
: While Not objRS.EOF
:
: For Each fldF In objRS.Fields
: Response.Write fldF.Value
: Next
:
: objRS.MoveNext
:
: Wend
:
: objRS.Close
: Set objRS=Nothing
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Message #3 by "Laurence Bier" <lbier@v...> on Wed, 13 Mar 2002 15:09:09 -0500
|
|
Thanks - that was a great help.
----- Original Message -----
From: "Ken Schaefer" <ken@a...>
To: "Access ASP" <access_asp@p...>
Sent: Sunday, March 10, 2002 6:49 PM
Subject: [access_asp] Re: ADODB.Connection error '800a0bb9' - why?
> You are doing this:
> : Set objRS=Server.CreateObject("ADODB.Connection")
>
> then you are doing this:
> : For Each fldF In objRS.Fields
> : Response.Write "Field:" & fldF.Name & "<br>"
> : Next
>
> .Fields is not a collection of the ADO Connection object - it is a
> collection of the ADO Recordset object.
>
> <%
> ' First you need to open a connection:
> Set objConn = Server.CreateObject("ADODB.Connection")
> objConn.Open "DSN=myDSN"
>
> ' Now we get a recordset from records in the database
> ' using the connection we just opened:
> strSQL = "SELECT field1 FROM table1"
> Set objRS = Server.CreateObject("ADODB.Recordset")
> objRS.Open strSQL, objConn
>
> For Each objField in objRS.Fields
> Response.Write("Field: " & objField.Name & "<br>")
> Next
> %>
>
> Cheers
> Ken
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> To: "Access ASP" <access_asp@p...>
>
>
> : I get this error using a _very_ basic script to read the field headings
> : and values in a Access database. I checked the archives of this and
other
> : boards as well as Microsoft support before asking this question. Though
it
> : doesn't use a global.asa file, when I put one in the virtual root it
fires
> : just fine. I have full read/write privileges to the database. To hedge
my
> : bets, I removed any space characters that were in the field headings,
> : replacing them with underscore characters ("first_name" instead of
"first
> : name") - as I'd read this was a possible source of this error. Still get
> : the same message. What follows is the script - taken pretty much
verbatim
> : from Wrox's Intro to ASP. And yes, the database is set up for a DSN
> : connection - a script that runs through the connection properties works
> : fine.
> : If you have any ideas, I'd love to hear them.
> :
> : <%
> :
> : dim objRS
> : Set objRS=Server.CreateObject("ADODB.Connection")
> :
> : dim fldF
> :
> : objRS.Open "DSN=novascotia12"
> :
> : For Each fldF In objRS.Fields
> : Response.Write "Field:" & fldF.Name & "<br>"
> : Next
> :
> : While Not objRS.EOF
> :
> : For Each fldF In objRS.Fields
> : Response.Write fldF.Value
> : Next
> :
> : objRS.MoveNext
> :
> : Wend
> :
> : objRS.Close
> : Set objRS=Nothing
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>
$subst('Email.Unsub').
|
|
 |