Hello
I need help. I'm getting this error message when i open one of my asp webpage. any suggestion how i can change my coding to make it work.
Error:
ADODB.Recordset error '800a0e78'
Operation is not allowed when the object is closed.
/l/a/o/laoclondon/Classified Advert Search Return.asp, line 28
This is my coding
Code:
1 <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
2 <!--#include file="Connections/Classified.asp" -->
3 <%
4 Dim Recordset1
5 Dim Recordset1_numRows
6
7 set oConnection=Server.CreateObject("ADODB.Connection")
8 oConnection.Provider="Microsoft.Jet.OLEDB.4.0"
9 oConnection.Open(Server.Mappath("database/Classified Advert.mdb"))
10 oConnection.close
11 Set oConnection = Nothing
12 Create an ADO RecordSet object
13 Set Recordset1 = Server.CreateObject("ADODB.Recordset")
14 Recordset1.Source = "SELECT * FROM Table1"
15 Recordset1.CursorType = 0
16 Recordset1.CursorLocation = 2
17 Recordset1.LockType = 1
18
19
20 Recordset1_numRows = 0
21 %>
22 <%
23 *** Recordset Stats, Move To Record, and Go To Record: declare stats variables
24
25 Dim Recordset1_total
26 Dim Recordset1_first
27 Dim Recordset1_last
28 Recordset1_total = Recordset1.RecordCount
29 set the record count
30
31
32 set the number of rows displayed on this page
33 If (Recordset1_numRows < 0) Then
34 Recordset1_numRows = Recordset1_total
35 Elseif (Recordset1_numRows = 0) Then
36 Recordset1_numRows = 1
37 End If
38
39 set the first and last displayed record
40 Recordset1_first = 1
41 Recordset1_last = Recordset1_first + Recordset1_numRows - 1
42
43 if we have the correct record count, check the other stats
44 If (Recordset1_total <> -1) Then
45 If (Recordset1_first > Recordset1_total) Then
46 Recordset1_first = Recordset1_total
47 End If
48 If (Recordset1_last > Recordset1_total) Then
49 Recordset1_last = Recordset1_total
50 End If
51 If (Recordset1_numRows > Recordset1_total) Then
52 Recordset1_numRows = Recordset1_total
53 End If
54 End If
55 %>
56 <%
57 Dim MM_paramName
58 %>
59 <%
60 *** Move To Record and Go To Record: declare variables
61
62 Dim MM_rs
63 Dim MM_rsCount
64 Dim MM_size
65 Dim MM_uniqueCol
66 Dim MM_offset
67 Dim MM_atTotal
68 Dim MM_paramIsDefined
69
70 Dim MM_param
71 Dim MM_index
72
73 Set MM_rs = Recordset1
74 MM_rsCount = Recordset1_total
75 MM_size = Recordset1_numRows
76 MM_uniqueCol = ""
77 MM_paramName = ""
78 MM_offset = 0
79 MM_atTotal = false
80 MM_paramIsDefined = false
81 If (MM_paramName <> "") Then
82 MM_paramIsDefined = (Request.QueryString(MM_paramName) <> "")
83 End If
84 %>
85 <%
86 *** Move To Record: handle 'index' or 'offset' parameter
87
88 if (Not MM_paramIsDefined And MM_rsCount <> 0) then
89
90 ' use index parameter if defined, otherwise use offset parameter
91 MM_param = Request.QueryString("index")
92 If (MM_param = "") Then
93 MM_param = Request.QueryString("offset")
94 End If
95 If (MM_param <> "") Then
96 MM_offset = Int(MM_param)
97 End If
98
99 ' if we have a record count, check if we are past the end of the recordset
100 If (MM_rsCount <> -1) Then