|
 |
access_asp thread: Connection error
Message #1 by Steven Lloyd <steven@s...> on Tue, 19 Nov 2002 12:13:23 +1100
|
|
I am working through a tutorial on ASP and have an error which is giving me
some grief. If somebody could please have a look at the following code and
tell me where I am going wrong. It is straight out of the tutorial so I
would have thought it would work.
------------------------------------------------------------
<%@ LANGUAGE="VBSCRIPT" %>
<% pageTitle = "" %>
<!--#include virtual="/ASP_TUT/PAGETOP.TXT" -->
<%
p_userid = Request.querystring("p-name")
p_pass1 = Request.querystring("p_pass1")
p_pass2 = Request.querystring("p_pass2")
p_first = Request.querystring("p_first")
p_last = Request.querystring("p_last")
p_email = Request.querystring("p_email")
set OUTPOST = Server.CreateObject("ADODB.Connection")
theSQL = "insert into members "
theSQL = theSQL & "(username, password, first_name, Last_name, "
theSQL = theSQL & "email, believes_in_aliens)"
theSQL = theSQL & " values ('"&p_userid&"', '"&p_pass1&"', '"
theSQL = theSQL & p_first&"', '"&p_last &"','"&p_email&"', '"
theSQL = theSQL & p_believes_in_aliens&"')"
OUTPOST.Execute(theSQL)
for each p_medium in Request.querystring("p_medium")
theSQL = "insert into userid_medium (userid, medium) values
('"&p_userid&"', '"&p_medium&"')"
OUTPOST.Execute(theSQL)
next
OUTPOST.close
set OUTPOST = Nothing
%>
<h2> User Registration</h2>
Userid: <%= p_userid %> <br>
Password: <%= p_pass1 %> <br>
Password2 <%= p_pass2 %> <br>
First Name: <%= p_first %> <br>
Last Name: <%= p_last %> <br>
Email: <%= p_email %> <br>
<%
for each p_medium in request.querystring("p_medium")
%>
Preferred medium: <%= p_medium %><br>
<%
next
%>
<!--#include virtual="/ASP_TUT/pagebottom.txt"-->
</body>
</html>
------------------------------------------------------------
The page is <http://www.showpage.com.au/ASP_TUT/take_registration.asp> It is
supposed to update the database with new registrations from the page
<http://www.showpage.com.au/ASP_TUT/register.asp> but instead gives me the
following error.
ADODB.Connection error '800a0e78'
The operation requested by the application is not allowed if the object is
closed.
/ASP_TUT/take_registration.asp, line 22
I guess the database is not being opened correctly but as I am a beginner I
cannot figure it out. :-(
Thanks
Message #2 by "Larry Woods" <larry@l...> on Mon, 18 Nov 2002 19:12:10 -0700
|
|
PLEASE specify WHAT error you are getting. It is VERY hard to
try to help you when there is no hint in your email as to what
problem that you are having.
Larry Woods
> -----Original Message-----
> From: Steven Lloyd [mailto:steven@s...]
> Sent: Monday, November 18, 2002 6:13 PM
> To: Access ASP
> Subject: [access_asp] Connection error
>
>
> I am working through a tutorial on ASP and have an
> error which is giving me
> some grief. If somebody could please have a look at
> the following code and
> tell me where I am going wrong. It is straight out of
> the tutorial so I
> would have thought it would work.
>
> ------------------------------------------------------------
>
> <%@ LANGUAGE="VBSCRIPT" %>
> <% pageTitle = "" %>
> <!--#include virtual="/ASP_TUT/PAGETOP.TXT" -->
>
> <%
> p_userid = Request.querystring("p-name")
> p_pass1 = Request.querystring("p_pass1")
> p_pass2 = Request.querystring("p_pass2")
> p_first = Request.querystring("p_first")
> p_last = Request.querystring("p_last")
> p_email = Request.querystring("p_email")
>
> set OUTPOST = Server.CreateObject("ADODB.Connection")
>
> theSQL = "insert into members "
> theSQL = theSQL & "(username, password,
> first_name, Last_name, "
> theSQL = theSQL & "email, believes_in_aliens)"
> theSQL = theSQL & " values ('"&p_userid&"',
> '"&p_pass1&"', '"
> theSQL = theSQL & p_first&"', '"&p_last
> &"','"&p_email&"', '"
> theSQL = theSQL & p_believes_in_aliens&"')"
>
> OUTPOST.Execute(theSQL)
>
> for each p_medium in Request.querystring("p_medium")
> theSQL = "insert into userid_medium (userid,
> medium) values
> ('"&p_userid&"', '"&p_medium&"')"
> OUTPOST.Execute(theSQL)
> next
>
> OUTPOST.close
> set OUTPOST = Nothing
> %>
>
> <h2> User Registration</h2>
>
> Userid: <%= p_userid %> <br>
> Password: <%= p_pass1 %> <br>
> Password2 <%= p_pass2 %> <br>
> First Name: <%= p_first %> <br>
> Last Name: <%= p_last %> <br>
> Email: <%= p_email %> <br>
>
> <%
> for each p_medium in request.querystring("p_medium")
> %>
> Preferred medium: <%= p_medium %><br>
> <%
> next
> %>
>
>
> <!--#include virtual="/ASP_TUT/pagebottom.txt"-->
> </body>
> </html>
>
> ------------------------------------------------------------
>
>
> The page is
<http://www.showpage.com.au/ASP_TUT/take_registration.asp> It is
supposed to update the database with new registrations from the
page
<http://www.showpage.com.au/ASP_TUT/register.asp> but instead
gives me the
following error.
ADODB.Connection error '800a0e78'
The operation requested by the application is not allowed if the
object is
closed.
/ASP_TUT/take_registration.asp, line 22
I guess the database is not being opened correctly but as I am a
beginner I
cannot figure it out. :-(
Thanks
Message #3 by "Larry Woods" <larry@l...> on Mon, 18 Nov 2002 19:16:56 -0700
|
|
And, here is what APPEARS to be wrong...
The connection is created, but it is never opened. Just creating
a Connection does not make it ready to "perform." Somewhere in
the code there has to be an OUTPOST.Open . AND, there has to be
a Connection String that defines WHAT Connection is to be opened.
Larry Woods
> -----Original Message-----
> From: Steven Lloyd [mailto:steven@s...]
> Sent: Monday, November 18, 2002 6:13 PM
> To: Access ASP
> Subject: [access_asp] Connection error
>
>
> I am working through a tutorial on ASP and have an
> error which is giving me
> some grief. If somebody could please have a look at
> the following code and
> tell me where I am going wrong. It is straight out of
> the tutorial so I
> would have thought it would work.
>
> ------------------------------------------------------------
>
> <%@ LANGUAGE="VBSCRIPT" %>
> <% pageTitle = "" %>
> <!--#include virtual="/ASP_TUT/PAGETOP.TXT" -->
>
> <%
> p_userid = Request.querystring("p-name")
> p_pass1 = Request.querystring("p_pass1")
> p_pass2 = Request.querystring("p_pass2")
> p_first = Request.querystring("p_first")
> p_last = Request.querystring("p_last")
> p_email = Request.querystring("p_email")
>
> set OUTPOST = Server.CreateObject("ADODB.Connection")
>
> theSQL = "insert into members "
> theSQL = theSQL & "(username, password,
> first_name, Last_name, "
> theSQL = theSQL & "email, believes_in_aliens)"
> theSQL = theSQL & " values ('"&p_userid&"',
> '"&p_pass1&"', '"
> theSQL = theSQL & p_first&"', '"&p_last
> &"','"&p_email&"', '"
> theSQL = theSQL & p_believes_in_aliens&"')"
>
> OUTPOST.Execute(theSQL)
>
> for each p_medium in Request.querystring("p_medium")
> theSQL = "insert into userid_medium (userid,
> medium) values
> ('"&p_userid&"', '"&p_medium&"')"
> OUTPOST.Execute(theSQL)
> next
>
> OUTPOST.close
> set OUTPOST = Nothing
> %>
>
> <h2> User Registration</h2>
>
> Userid: <%= p_userid %> <br>
> Password: <%= p_pass1 %> <br>
> Password2 <%= p_pass2 %> <br>
> First Name: <%= p_first %> <br>
> Last Name: <%= p_last %> <br>
> Email: <%= p_email %> <br>
>
> <%
> for each p_medium in request.querystring("p_medium")
> %>
> Preferred medium: <%= p_medium %><br>
> <%
> next
> %>
>
>
> <!--#include virtual="/ASP_TUT/pagebottom.txt"-->
> </body>
> </html>
>
> ------------------------------------------------------------
>
>
> The page is
<http://www.showpage.com.au/ASP_TUT/take_registration.asp> It is
supposed to update the database with new registrations from the
page
<http://www.showpage.com.au/ASP_TUT/register.asp> but instead
gives me the
following error.
ADODB.Connection error '800a0e78'
The operation requested by the application is not allowed if the
object is
closed.
/ASP_TUT/take_registration.asp, line 22
I guess the database is not being opened correctly but as I am a
beginner I
cannot figure it out. :-(
Thanks
Message #4 by Steven Lloyd <steven@s...> on Tue, 19 Nov 2002 15:37:06 +1100
|
|
OK,
I have amended the page from
set OUTPOST = Server.CreateObject("ADODB.Connection")
to
set outpostDB = Server.CreateObject("ADODB.Connection")
outpostDB.open "OUTPOST"
(I changed "OUTPOST" to "outpostDB" because this is how it is actually
written in the tutorial and, according to my ISP my DSN is "OUTPOST" )
Now I get a different error message.
----------------------------
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Driver Manager] Data source name not found and no default
driver specified
/ASP_TUT/take_registration.asp, line 14
----------------------------
I will confirm the DSN name with my ISP but if you have any further clues
they would be appreciated.
Regards
Steven Llloyd
On 19/11/2002 1:16 PM, "Larry Woods" <larry@l...> wrote:
> And, here is what APPEARS to be wrong...
>
> The connection is created, but it is never opened. Just creating
> a Connection does not make it ready to "perform." Somewhere in
> the code there has to be an OUTPOST.Open . AND, there has to be
> a Connection String that defines WHAT Connection is to be opened.
>
> Larry Woods
>
>
Message #5 by "Ken Schaefer" <ken@a...> on Tue, 19 Nov 2002 15:58:52 +1100
|
|
<%
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "DSN=Output"
%>
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Steven Lloyd" <steven@s...>
Subject: [access_asp] RE: Connection error
: OK,
:
: I have amended the page from
:
: set OUTPOST = Server.CreateObject("ADODB.Connection")
:
: to
:
: set outpostDB = Server.CreateObject("ADODB.Connection")
: outpostDB.open "OUTPOST"
:
: (I changed "OUTPOST" to "outpostDB" because this is how it is actually
: written in the tutorial and, according to my ISP my DSN is "OUTPOST" )
:
: Now I get a different error message.
:
: ----------------------------
:
: Microsoft OLE DB Provider for ODBC Drivers error '80004005'
: [Microsoft][ODBC Driver Manager] Data source name not found and no default
: driver specified
: /ASP_TUT/take_registration.asp, line 14
:
: ----------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
 |