|
 |
access_asp thread: ADODB Reset Error
Message #1 by "Wang, Julia" <Julia.Wang@R...> on Fri, 14 Dec 2001 11:21:57 -0600
|
|
Can some one read the following code and help me figure out what is wrong?
Thanks a million!
Error message:
ADODB.Recordset error '800a0e78'
The operation requested by the application is not
allowed if the object is closed.
/wangj/asp1/simplers4.asp, line 50
CODE:
<%
Dim name, cat, mySQL, myRS
Set myRS = Server.CreateObject("ADODB.Recordset")
If Request.Form("Product") <> "" Then
name = Request.Form("Product")
mySQL = "SELECT * FROM Products WHERE Name
'" &name & "'"
myRS.Open mySQL, myConn
End If
If Request.Form("cat") <> "" Then
cat = Request.Form("cat")
mySQL = "SELECT * FROM Products WHERE
Category ='" &cat & "'"
myRS.Open mySQL, myConn
End If
%>
<table border = "1">
<tr>
<%
Dim i, image
For i=0 to myRS.Fields.Count-1
%>
<th><%=myRS(i).Name %></th>
<% Next %>
</tr>
<% While Not myRS.EOF %>
<tr>
<% For i=0 to myRS.Fields.Count-1 %>
<td>
<% If IsNull(myRS(i)) Then
Response.Write " "
Else
Response.Write
myRS(i).Value
End If %>
</td>
<% Next %>
<td><% image = myRS("Image").Value
%>
<img
src="graphics/<%=image%>"></td>
</tr>
<%
myRS.MoveNext
Wend
myRS.Close
Set myRS = Nothing
myConn.Close
Set myConn = Nothing
%>
<*><*><*><*><*><*><*><*><*><*>
Julia
Message #2 by "Zee Computer Consulting" <zee@t...> on Fri, 14 Dec 2001 20:30:10 -0800
|
|
Julia,
This must be a busy day for you. Try replacing these lines:
If Request.Form("Product") <> "" Then
If Request.Form("cat") <> "" Then
with lines like this:
IF len(trim(Request.Form( "Product" ) )) = 0 THEN
IF len(trim( Request.Form( "cat" ) )) = 0 THEN
because there is something about:
<> ""
that doesn't seem to work as anticipated.
Z
----- Original Message -----
From: "Wang, Julia" <Julia.Wang@R...>
To: "Access ASP" <access_asp@p...>
Sent: Friday, December 14, 2001 9:21 AM
Subject: [access_asp] ADODB Reset Error
> Can some one read the following code and help me figure out what is wrong?
> Thanks a million!
> Error message:
>
> ADODB.Recordset error '800a0e78'
> The operation requested by the application is not
> allowed if the object is closed.
>
> /wangj/asp1/simplers4.asp, line 50
>
> CODE:
> <%
> Dim name, cat, mySQL, myRS
> Set myRS = Server.CreateObject("ADODB.Recordset")
> If Request.Form("Product") <> "" Then
> name = Request.Form("Product")
> mySQL = "SELECT * FROM Products WHERE Name
> '" &name & "'"
> myRS.Open mySQL, myConn
> End If
> If Request.Form("cat") <> "" Then
> cat = Request.Form("cat")
> mySQL = "SELECT * FROM Products WHERE
> Category ='" &cat & "'"
> myRS.Open mySQL, myConn
> End If
> %>
> <table border = "1">
> <tr>
> <%
> Dim i, image
> For i=0 to myRS.Fields.Count-1
> %>
> <th><%=myRS(i).Name %></th>
> <% Next %>
> </tr>
> <% While Not myRS.EOF %>
> <tr>
> <% For i=0 to myRS.Fields.Count-1 %>
> <td>
> <% If IsNull(myRS(i)) Then
> Response.Write " "
> Else
> Response.Write
> myRS(i).Value
> End If %>
> </td>
> <% Next %>
>
> <td><% image = myRS("Image").Value
> %>
> <img
> src="graphics/<%=image%>"></td>
> </tr>
> <%
> myRS.MoveNext
> Wend
> myRS.Close
> Set myRS = Nothing
> myConn.Close
> Set myConn = Nothing
> %>
>
> <*><*><*><*><*><*><*><*><*><*>
> Julia
>
$subst('Email.Unsub').
Message #3 by "Wang, Julia" <Julia.Wang@R...> on Mon, 17 Dec 2001 08:19:50 -0600
|
|
Zee, Thanks for the advice but it still doesn't work. Is there anything to
do with the database?
Julia
<*><*><*><*><*><*><*><*><*><*>
-----Original Message-----
From: Zee Computer Consulting [mailto:zee@t...]
Sent: Friday, December 14, 2001 10:30 PM
To: Access ASP
Subject: [access_asp] Re: ADODB Reset Error
Julia,
This must be a busy day for you. Try replacing these lines:
If Request.Form("Product") <> "" Then
If Request.Form("cat") <> "" Then
with lines like this:
IF len(trim(Request.Form( "Product" ) )) = 0 THEN
IF len(trim( Request.Form( "cat" ) )) = 0 THEN
because there is something about:
<> ""
that doesn't seem to work as anticipated.
Z
----- Original Message -----
From: "Wang, Julia" <Julia.Wang@R...>
To: "Access ASP" <access_asp@p...>
Sent: Friday, December 14, 2001 9:21 AM
Subject: [access_asp] ADODB Reset Error
> Can some one read the following code and help me figure out what is wrong?
> Thanks a million!
> Error message:
>
> ADODB.Recordset error '800a0e78'
> The operation requested by the application is not
> allowed if the object is closed.
>
> /wangj/asp1/simplers4.asp, line 50
>
> CODE:
> <%
> Dim name, cat, mySQL, myRS
> Set myRS = Server.CreateObject("ADODB.Recordset")
> If Request.Form("Product") <> "" Then
> name = Request.Form("Product")
> mySQL = "SELECT * FROM Products WHERE Name
> '" &name & "'"
> myRS.Open mySQL, myConn
> End If
> If Request.Form("cat") <> "" Then
> cat = Request.Form("cat")
> mySQL = "SELECT * FROM Products WHERE
> Category ='" &cat & "'"
> myRS.Open mySQL, myConn
> End If
> %>
> <table border = "1">
> <tr>
> <%
> Dim i, image
> For i=0 to myRS.Fields.Count-1
> %>
> <th><%=myRS(i).Name %></th>
> <% Next %>
> </tr>
> <% While Not myRS.EOF %>
> <tr>
> <% For i=0 to myRS.Fields.Count-1 %>
> <td>
> <% If IsNull(myRS(i)) Then
> Response.Write " "
> Else
> Response.Write
> myRS(i).Value
> End If %>
> </td>
> <% Next %>
>
> <td><% image = myRS("Image").Value
> %>
> <img
> src="graphics/<%=image%>"></td>
> </tr>
> <%
> myRS.MoveNext
> Wend
> myRS.Close
> Set myRS = Nothing
> myConn.Close
> Set myConn = Nothing
> %>
>
> <*><*><*><*><*><*><*><*><*><*>
> Julia
>
$subst('Email.Unsub').
|
|
 |