 |
| Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

July 22nd, 2004, 03:49 PM
|
|
Authorized User
|
|
Join Date: Mar 2004
Posts: 84
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Sorting Problems - PLEASE HELP! last resort
I am having a problem sorting my record sets. This is what i have so far, and i get the error listed below whenever i click any of the text header links.
Error:
ADODB.Recordset error '800a0e78'
Operation is not allowed when the object is closed.
/sites.asp, line 89
Code:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Adminstraive Area - Sites</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<%
'Declares Variables
Dim dbName
Dim ObjConn
Dim Admin
Dim SSort
SSort = Request.QueryString("Sort")
Dim BBy
If Request.QueryString("By") <> "" Then
BBy = Request.QueryString("By")
Else
BBy = "ASC"
End If
Dim PageItems
Dim nPageCount
Dim nPage
nPage = CLng(Request.QueryString("Page"))
Dim CountPages
Dim MSiteID
Dim MSiteName
Dim MEmailAddress
Dim MDDate
'Sets Up Database Connection
dbName = "/fpdb/topsites.mdb"
ObjConn= "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" & Server.MapPath(dbName)
'Connects to Database
Set Admin = Server.CreateObject("ADODB.RecordSet")
If Request.QueryString("Sort") <> "" Then
If Request.QueryString("Sort") = Approved Then
If Request.QueryString("By") = Desc Then
Admin.Open "SELECT * From Users order BY Approved Desc",ObjConn,3,3
End If
If Request.QueryString("By") = ASC Then
Admin.Open "SELECT * FROM Users order BY Approved ASC",ObjConn,3,3
End If
End If
If Request.QueryString("Sort") = SiteID Then
If Request.QueryString("By") = Desc Then
Admin.Open "SELECT * FROM Users order BY SiteID Desc",ObjConn,3,3
MSiteID = "Down"
End If
If Request.QueryString("By") = ASC Then
Admin.Open "SELECT * FROM Users order BY SiteID ASC",ObjConn,3,3
MSiteID = "Up"
End If
End If
If Request.QueryString("Sort") = SiteName Then
If Request.QueryString("By") = Desc Then
Admin.Open "SELECT * FROM Users order BY Site_Name Desc",ObjConn,3,3
MSiteName = "Down"
End If
If Request.QueryString("By") = ASC Then
Admin.Open "SELECT * FROM Users order BY Site_Name ASC",ObjConn,3,3
MSiteName = "Up"
End If
End If
If Request.QueryString("Sort") = EmailAddress Then
If Request.QueryString("By") = Desc Then
Admin.Open "SELECT * FROM Users order BY Client_Email Desc",ObjConn,3,3
MEmailAddress = "Down"
End If
If Request.QueryString("By") = ASC Then
Admin.Open "SELECT * FROM Users order BY Client_Email ASC",ObjConn,3,3
MEmailAddress = "Up"
End If
End If
If Request.QueryString("Sort") = DDate Then
If Request.QueryString("By") = Desc Then
Admin.Open "SELECT * FROM Users order BY Date_Created Desc",ObjConn,3,3
MDDate = "Down"
End If
If Request.QueryString("By") = ASC Then
Admin.Open "SELECT * FROM Users order BY Date_Created ASC",ObjConn,3,3
MDDate = "Up"
End If
End If
Else
Admin.Open "SELECT * FROM Users order BY SiteID ASC",ObjConn,3,3
MSiteID = "Up"
End If
PageItems = Admin.PageSize
nPageCount = Admin.PageCount
If nPage < 1 Or nPage > nPageCount Then
nPage = 1
End If
%>
</head>
<body>
<table width="600" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="20" height="20" background="http://www.topdeckcards.com/images/headerback.gif"><div align="center"><a href="sites.asp?Sort=Approved&By=<% If BBy = "ASC" Then Response.Write("DESC") Else Response.Write("ASC") %>"><img src="images/alert.gif" width="13" height="13" border="0"></a></div></td>
<td width="20" height="20" background="http://www.topdeckcards.com/images/headerback.gif"><div align="center"><img src="images/delete.gif" width="14" height="16"></div></td>
<td width="70" height="20" background="http://www.topdeckcards.com/images/headerback.gif"><div align="left"><strong><a href=sites.asp?Sort=SiteID&By=<% If BBy = "ASC" Then
Response.Write("DESC")
Else
Response.Write("ASC")
End If
%>>
<%
If MSiteID = "Up" Then
Response.Write("<img src=images/uparrow.gif width=13 height=13 border=0>")
End If
If MSiteID = "Down" Then
Response.Write("<img src=images/downarrow.gif width=13 height=13 border=0>")
End If
If MSiteID = "" Then
Response.Write("")
End If
%> Site ID</a></strong></div></td>
<td width="200" height="20" background="http://www.topdeckcards.com/images/headerback.gif"><div align="left"><strong><a href=sites.asp?Sort=SiteName&By=
<% If BBy = "ASC" Then
Response.Write("DESC")
Else
Response.Write("ASC")
End IF
%>>
<% If MSiteName = "Up" Then
Response.Write("<img src=images/uparrow.gif width=13 height=13 border=0>")
End If
If MSiteName = "Down" Then
Response.Write("<img src=images/downarrow.gif width=13 height=13 border=0>")
End If
If MSiteName = "" Then
Response.Write("")
End If
%> Site Name</a></strong></div></td>
<td width="230" height="20" background="http://www.topdeckcards.com/images/headerback.gif"><div align="left"><strong><a href=sites.asp?Sort=EmailAddress&By=
<% If BBy = "ASC" Then
Response.Write("DESC")
Else
Response.Write("ASC")
End If
%>>
<% If MEmailAddress = "Up" Then
Response.Write("<img src=images/uparrow.gif width=13 height=13 border=0>")
End If
If MEmailAddress = "Down" Then
Response.Write("<img src=images/downarrow.gif width=13 height=13 border=0>")
End If
If MEmailAddress = "" Then
Response.Write("")
End If
%> Email Address</a></strong></div></td>
<td width="65" height="20" background="http://www.topdeckcards.com/images/headerback.gif"><div align="left"><strong><a href=sites.asp?Sort=DDate&By=
<% If BBy = "ASC" Then
Response.Write("DESC")
Else
Response.Write("ASC")
End If
%>>
<% If MDDate = "Up" Then
Response.Write("<img src=images/uparrow.gif width=13 height=13 border=0>")
End If
If MDDate = "Down" Then
Response.Write("<img src=images/downarrow.gif width=13 height=13 border=0>")
End If
If MDDate = "" Then
Response.Write("")
End If
%> Date</a></strong></div></td>
</tr>
<% Admin.AbsolutePage = nPage
Do While Not ( Admin.EOF Or Admin.AbsolutePage <> nPage )
%>
<tr>
<td><% If Admin("Approved") <> True Then Response.Write("<div align=center><a href=approve.asp?SiteID="&Admin("SiteID")&"><img src=images/alert.gif width=13 height=13 border=0></a></div>") Else Response.Write("") End IF %></td>
<td><% Response.Write("<div align=center><a href=delete.asp?SiteID="&Admin("SiteID")&"><img src=images/delete.gif width=13 height=13 border=0></a></div>") %></td>
<td><% Response.Write("<div align=center><a href=edit.asp?SiteID="&Admin("SiteID")&">"&Admin("SiteID")&"</a></div>") %></td>
<td><% Response.Write("<div align=left><a href="&Admin("Site_URL")&" target=_blank>"&Admin("Site_Name")&"</a></div>") %></td>
<td><% Response.Write("<div align=left><a href=Mailto:"&Admin("Client_Email")&">"&Admin("Client_Email")&"</a></div>") %></td>
<td><% Response.Write("<div align=left>"&Admin("Date_Created")&"</div>") %></td>
</tr>
<%
Admin.MoveNext
Loop
%>
</table>
<br>
<div align="center">Page Number:</div>
<div align="center">
<% For CountPages = 1 to nPageCount
Response.Write "<a href=sites.asp?Page="&CountPages& ">" & CountPages & "</a> "
Next
%></div>
</body>
</html>
|
|

July 22nd, 2004, 09:02 PM
|
|
Friend of Wrox
|
|
Join Date: Sep 2003
Posts: 363
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Hello,
U missed this statement
set objConn=server.createObject("ADODB.connection")
|
|

July 23rd, 2004, 02:29 AM
|
|
Authorized User
|
|
Join Date: Feb 2004
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
can u point out where is the line no 89 it will helpfull to find out error
|
|

July 24th, 2004, 01:04 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Yes, RajaniKrishna is right. You have not created your Connection object, instead setting up all its values and trying to use it. You got to create one before doing so.
Cheers!
_________________________
- Vijay G
Strive for Perfection
|
|
 |