ASP.NET School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become a ASP.NET Expert!

Join 300,406 ASP.NET Programmers for FREE! Get instant access to thousands of ASP.NET experts, tutorials, code snippets, and more! There are 1,592 people online right now. Registration is fast and FREE... Join Now!




ASP Programming problem

 

ASP Programming problem

laoclondon

5 Jun, 2009 - 08:04 PM
Post #1

New D.I.C Head
*

Joined: 5 Jun, 2009
Posts: 3

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                        
101        If (MM_offset >= MM_rsCount Or MM_offset = -1) Then  ' past end or move last                        
102          If ((MM_rsCount Mod MM_size) > 0) Then         ' last page not a full repeat region                        
103            MM_offset = MM_rsCount - (MM_rsCount Mod MM_size)                        
104          Else                        
105            MM_offset = MM_rsCount - MM_size                        
106          End If                        
107        End If                        
108      End If                        
109                            
110      ' move the cursor to the selected record                        
111      MM_index = 0                        
112      While ((Not MM_rs.EOF) And (MM_index < MM_offset Or MM_offset = -1))                        
113        MM_rs.MoveNext                        
114        MM_index = MM_index + 1                        
115      Wend                        
116      If (MM_rs.EOF) Then                         
117        MM_offset = MM_index  ' set MM_offset to the last possible record                        
118      End If                        
119                            
120    End If                        
121    %>                        
122    <%                        
123     *** Move To Record: if we dont know the record count, check the display range                        
124                            
125    If (MM_rsCount = -1) Then                        
126                            
127      ' walk to the end of the display range for this page                        
128      MM_index = MM_offset                        
129      While (Not MM_rs.EOF And (MM_size < 0 Or MM_index < MM_offset + MM_size))                        
130        MM_rs.MoveNext                        
131        MM_index = MM_index + 1                        
132      Wend                        
133                            
134      ' if we walked off the end of the recordset, set MM_rsCount and MM_size                        
135      If (MM_rs.EOF) Then                        
136        MM_rsCount = MM_index                        
137        If (MM_size < 0 Or MM_size > MM_rsCount) Then                        
138          MM_size = MM_rsCount                        
139        End If                        
140      End If                        
141                            
142      ' if we walked off the end, set the offset based on page size                        
143      If (MM_rs.EOF And Not MM_paramIsDefined) Then                        
144        If (MM_offset > MM_rsCount - MM_size Or MM_offset = -1) Then                        
145          If ((MM_rsCount Mod MM_size) > 0) Then                        
146            MM_offset = MM_rsCount - (MM_rsCount Mod MM_size)                        
147          Else                        
148            MM_offset = MM_rsCount - MM_size                        
149          End If                        
150        End If                        
151      End If                        
152                            
153      ' reset the cursor to the beginning                        
154      If (MM_rs.CursorType > 0) Then                        
155        MM_rs.MoveFirst                        
156      Else                        
157        MM_rs.Requery                        
158      End If                        
159                            
160      ' move the cursor to the selected record                        
161      MM_index = 0                        
162      While (Not MM_rs.EOF And MM_index < MM_offset)                        
163        MM_rs.MoveNext                        
164        MM_index = MM_index + 1                        
165      Wend                        
166    End If                        
167    %>                        
168    <%                        
169     *** Move To Record: update recordset stats                        
170                            
171     set the first and last displayed record                        
172    Recordset1_first = MM_offset + 1                        
173    Recordset1_last  = MM_offset + MM_size                        
174                            
175    If (MM_rsCount <> -1) Then                        
176      If (Recordset1_first > MM_rsCount) Then                        
177        Recordset1_first = MM_rsCount                        
178      End If                        
179      If (Recordset1_last > MM_rsCount) Then                        
180        Recordset1_last = MM_rsCount                        
181      End If                        
182    End If                        
183                            
184     set the boolean used by hide region to check if we are on the last record                        
185    MM_atTotal = (MM_rsCount <> -1 And MM_offset + MM_size >= MM_rsCount)                        
186    %>                        
187    <%                        
188     *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters                        
189                            
190    Dim MM_keepNone                        
191    Dim MM_keepURL                        
192    Dim MM_keepForm                        
193    Dim MM_keepBoth                        
194                            
195    Dim MM_removeList                        
196    Dim MM_item                        
197    Dim MM_nextItem                        
198                            
199     create the list of parameters which should not be maintained                        
200    MM_removeList = "&index="                        
201    If (MM_paramName <> "") Then                        
202      MM_removeList = MM_removeList & "&" & MM_paramName & "="                        
203    End If                        
204                            
205    MM_keepURL=""                        
206    MM_keepForm=""                        
207    MM_keepBoth=""                        
208    MM_keepNone=""                        
209                            
210     add the URL parameters to the MM_keepURL string                        
211    For Each MM_item In Request.QueryString                        
212      MM_nextItem = "&" & MM_item & "="                        
213      If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then                        
214        MM_keepURL = MM_keepURL & MM_nextItem & Server.URLencode(Request.QueryString(MM_item))                        
215      End If                        
216    Next                        
217                            
218     add the Form variables to the MM_keepForm string                        
219    For Each MM_item In Request.Form                        
220      MM_nextItem = "&" & MM_item & "="                        
221      If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then                        
222        MM_keepForm = MM_keepForm & MM_nextItem & Server.URLencode(Request.Form(MM_item))                        
223      End If                        
224    Next                        
225                            
226     create the Form + URL string and remove the intial '&' from each of the strings                        
227    MM_keepBoth = MM_keepURL & MM_keepForm                        
228    If (MM_keepBoth <> "") Then                         
229      MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)                        
230    End If                        
231    If (MM_keepURL <> "")  Then                        
232      MM_keepURL  = Right(MM_keepURL, Len(MM_keepURL) - 1)                        
233    End If                        
234    If (MM_keepForm <> "") Then                        
235      MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)                        
236    End If                        
237                            
238     a utility function used for adding additional parameters to these strings                        
239    Function MM_joinChar(firstItem)                        
240      If (firstItem <> "") Then                        
241        MM_joinChar = "&"                        
242      Else                        
243        MM_joinChar = ""                        
244      End If                        
245    End Function                        
246    %>                        
247    <%                        
248     *** Move To Record: set the strings for the first, last, next, and previous links                        
249                            
250    Dim MM_keepMove                        
251    Dim MM_moveParam                        
252    Dim MM_moveFirst                        
253    Dim MM_moveLast                        
254    Dim MM_moveNext                        
255    Dim MM_movePrev                        
256                            
257    Dim MM_urlStr                        
258    Dim MM_paramList                        
259    Dim MM_paramIndex                        
260    Dim MM_nextParam                        
261                            
262    MM_keepMove = MM_keepBoth                        
263    MM_moveParam = "index"                        
264                            
265     if the page has a repeated region, remove 'offset' from the maintained parameters                        
266    If (MM_size > 1) Then                        
267      MM_moveParam = "offset"                        
268      If (MM_keepMove <> "") Then                        
269        MM_paramList = Split(MM_keepMove, "&")                        
270        MM_keepMove = ""                        
271        For MM_paramIndex = 0 To UBound(MM_paramList)                        
272          MM_nextParam = Left(MM_paramList(MM_paramIndex), InStr(MM_paramList(MM_paramIndex),"=") - 1)                        
273          If (StrComp(MM_nextParam,MM_moveParam,1) <> 0) Then                        
274            MM_keepMove = MM_keepMove & "&" & MM_paramList(MM_paramIndex)                        
275          End If                        
276        Next                        
277        If (MM_keepMove <> "") Then                        
278          MM_keepMove = Right(MM_keepMove, Len(MM_keepMove) - 1)                        
279        End If                        
280      End If                        
281    End If                        
282                            
283     set the strings for the move to links                        
284    If (MM_keepMove <> "") Then                         
285      MM_keepMove = MM_keepMove & "&"                        
286    End If                        
287                            
288    MM_urlStr = Request.ServerVariables("URL") & "?" & MM_keepMove & MM_moveParam & "="                        
289                            
290    MM_moveFirst = MM_urlStr & "0"                        
291    MM_moveLast  = MM_urlStr & "-1"                        
292    MM_moveNext  = MM_urlStr & CStr(MM_offset + MM_size)                        
293    If (MM_offset - MM_size < 0) Then                        
294      MM_movePrev = MM_urlStr & "0"                        
295    Else                        
296      MM_movePrev = MM_urlStr & CStr(MM_offset - MM_size)                        
297    End If                        
298    %>                        
299    <html>                        
300    <head>                        
301    <title>London Adult Online Community</title>                        
302    <!-- meta information for search engines -->                        
303    <meta name="generator" content="Nucleus CMS v3.32" />                        
304  

User is offlineProfile CardPM
+Quote Post


JayFCox

RE: ASP Programming Problem

6 Jun, 2009 - 06:50 AM
Post #2

New D.I.C Head
*

Joined: 31 May, 2009
Posts: 41



Thanked: 5 times
My Contributions
You're opening a connection to an access database, closing it, and then not initializing the recordset with the connection?
User is offlineProfile CardPM
+Quote Post

laoclondon

RE: ASP Programming Problem

8 Jun, 2009 - 06:00 AM
Post #3

New D.I.C Head
*

Joined: 5 Jun, 2009
Posts: 3

Thanks for your reply.

What should do next?

Should I just delete the two lines? or replace the code with .....? or Where should I put the code

Any suggested is much appreciated

User is offlineProfile CardPM
+Quote Post

woodjom

RE: ASP Programming Problem

8 Jun, 2009 - 10:30 AM
Post #4

D.I.C Regular
Group Icon

Joined: 8 May, 2008
Posts: 365



Thanked: 15 times
My Contributions
I want to know why your using an Access database? Why not install MySQL and utilize its reduce resource overhead. But thats neither here nor there.

general flow of database connections:
create connection string
create sql query
open connection string
create datasource object with connection string and query
execute query into a variable or control object
clean up leftovers
close connection object

Now your problem is here:
CODE

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  <====HERE
11    Set oConnection = Nothing   <========HERE                
12    Create an ADO RecordSet object  
    ^Hope this is a comment above  

13    Set Recordset1 = Server.CreateObject("ADODB.Recordset")
    ^What connection are you using for this Recordset1?                        

14    Recordset1.Source = "SELECT * FROM Table1"                        
15    Recordset1.CursorType = 0                        
16    Recordset1.CursorLocation = 2                        
17    Recordset1.LockType = 1                        
18                            
19                            
20    Recordset1_numRows = 0
    ^This needs to be put into a variable otherwise you will get an error
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


This post has been edited by woodjom: 8 Jun, 2009 - 10:34 AM
User is offlineProfile CardPM
+Quote Post

laoclondon

RE: ASP Programming Problem

8 Jun, 2009 - 05:15 PM
Post #5

New D.I.C Head
*

Joined: 5 Jun, 2009
Posts: 3

Thanks for your reply

After taking the two lines out i'm now getting a new error message.

The page now opens but it doesn't shows the data

Error message:



ADODB.Fieldserror '800a0cc1'
Item cannot be found in the collection corresponding to the requested name or ordinal. /l/a/o/laoclondon/Classified Advert Search Return.asp, line 388

This is me new codes:
CODE

1<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
2<!--#include file="Connections/Classified.asp" -->
3<%
4Dim Recordset1
5Dim Recordset1_numRows
6

7set oConnection=Server.CreateObject("ADODB.Connection" )
8oConnection.Provider="Microsoft.Jet.OLEDB.4.0"
9oConnection.Open(Server.Mappath("database/Classified Advert.mdb"))
10

11Create an ADO RecordSet object
12Set Recordset1 = Server.CreateObject("ADODB.Recordset")
13Recordset1.Source = "SELECT * FROM Table1"
14Recordset1.CursorType = 0
15Recordset1.CursorLocation = 2
16Recordset1.LockType = 1
17

18

19Recordset1_numRows = 0
20%>
21<%
22*** Recordset Stats, Move To Record, and Go To Record: declare stats variables
23

24Dim Recordset1_total
25Dim Recordset1_first
26Dim Recordset1_last
27

28set the record count
29

30

31set the number of rows displayed on this page
32If (Recordset1_numRows < 0) Then
33Recordset1_numRows = Recordset1_total
34Elseif (Recordset1_numRows = 0) Then
35Recordset1_numRows = 1
36End If
37

38set the first and last displayed record
39Recordset1_first = 1
40Recordset1_last = Recordset1_first + Recordset1_numRows - 1
41

42if we have the correct record count, check the other stats
43If (Recordset1_total <> -1) Then
44If (Recordset1_first > Recordset1_total) Then
45Recordset1_first = Recordset1_total
46End If
47If (Recordset1_last > Recordset1_total) Then
48Recordset1_last = Recordset1_total
49End If
50If (Recordset1_numRows > Recordset1_total) Then
51Recordset1_numRows = Recordset1_total
52End If
53End If
54%>
55<%
56Dim MM_paramName
57%>
58<%
59*** Move To Record and Go To Record: declare variables
60

61Dim MM_rs
62Dim MM_rsCount
63Dim MM_size
64Dim MM_uniqueCol
65Dim MM_offset
66Dim MM_atTotal
67Dim MM_paramIsDefined
68

69Dim MM_param
70Dim MM_index
71

72Set MM_rs = Recordset1
73MM_rsCount = Recordset1_total
74MM_size = Recordset1_numRows
75MM_uniqueCol = ""
76MM_paramName = ""
77MM_offset = 0
78MM_atTotal = false
79MM_paramIsDefined = false
80If (MM_paramName <> "") Then
81MM_paramIsDefined = (Request.QueryString(MM_paramName) <> "")
82End If
83%>
84<%
85*** Move To Record: handle 'index' or 'offset' parameter
86

87if (Not MM_paramIsDefined And MM_rsCount <> 0) then
88

89' use index parameter if defined, otherwise use offset parameter
90MM_param = Request.QueryString("index")
91If (MM_param = "") Then
92MM_param = Request.QueryString("offset")
93End If
94If (MM_param <> "") Then
95MM_offset = Int(MM_param)
96End If
97

98' if we have a record count, check if we are past the end of the recordset
99If (MM_rsCount <> -1) Then
100If (MM_offset >= MM_rsCount Or MM_offset = -1) Then ' past end or move last
101If ((MM_rsCount Mod MM_size) > 0) Then ' last page not a full repeat region
102MM_offset = MM_rsCount - (MM_rsCount Mod MM_size)
103Else
104MM_offset = MM_rsCount - MM_size
105End If
106End If
107End If
108

109' move the cursor to the selected record
110MM_index = 0
111While ((Not MM_rs.EOF) And (MM_index < MM_offset Or MM_offset = -1))
112MM_rs.MoveNext
113MM_index = MM_index + 1
114Wend
115If (MM_rs.EOF) Then
116MM_offset = MM_index ' set MM_offset to the last possible record
117End If
118

119End If
120%>
121<%
122*** Move To Record: if we dont know the record count, check the display range
123

124If (MM_rsCount = -1) Then
125

126' walk to the end of the display range for this page
127MM_index = MM_offset
128While (Not MM_rs.EOF And (MM_size < 0 Or MM_index < MM_offset + MM_size))
129MM_rs.MoveNext
130MM_index = MM_index + 1
131Wend
132

133' if we walked off the end of the recordset, set MM_rsCount and MM_size
134If (MM_rs.EOF) Then
135MM_rsCount = MM_index
136If (MM_size < 0 Or MM_size > MM_rsCount) Then
137MM_size = MM_rsCount
138End If
139End If
140

141' if we walked off the end, set the offset based on page size
142If (MM_rs.EOF And Not MM_paramIsDefined) Then
143If (MM_offset > MM_rsCount - MM_size Or MM_offset = -1) Then
144If ((MM_rsCount Mod MM_size) > 0) Then
145MM_offset = MM_rsCount - (MM_rsCount Mod MM_size)
146Else
147MM_offset = MM_rsCount - MM_size
148End If
149End If
150End If
151

152' reset the cursor to the beginning
153If (MM_rs.CursorType > 0) Then
154MM_rs.MoveFirst
155Else
156MM_rs.Requery
157End If
158

159' move the cursor to the selected record
160MM_index = 0
161While (Not MM_rs.EOF And MM_index < MM_offset)
162MM_rs.MoveNext
163MM_index = MM_index + 1
164Wend
165End If
166%>
167<%
168*** Move To Record: update recordset stats
169

170set the first and last displayed record
171Recordset1_first = MM_offset + 1
172Recordset1_last = MM_offset + MM_size
173

174If (MM_rsCount <> -1) Then
175If (Recordset1_first > MM_rsCount) Then
176Recordset1_first = MM_rsCount
177End If
178If (Recordset1_last > MM_rsCount) Then
179Recordset1_last = MM_rsCount
180

181End If
182End If
183

184set the boolean used by hide region to check if we are on the last record
185MM_atTotal = (MM_rsCount <> -1 And MM_offset + MM_size >= MM_rsCount)
186%>
187<%
188*** Go To Record and Move To Record: create strings for maintaining URL and Form parameters
189

190Dim MM_keepNone
191Dim MM_keepURL
192Dim MM_keepForm
193Dim MM_keepBoth
194

195Dim MM_removeList
196Dim MM_item
197Dim MM_nextItem
198

199create the list of parameters which should not be maintained
200MM_removeList = "&index="
201If (MM_paramName <> "") Then
202MM_removeList = MM_removeList & "&" & MM_paramName & "="
203End If
204

205MM_keepURL=""
206MM_keepForm=""
207MM_keepBoth=""
208MM_keepNone=""
209

210add the URL parameters to the MM_keepURL string
211For Each MM_item In Request.QueryString
212MM_nextItem = "&" & MM_item & "="
213If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
214MM_keepURL = MM_keepURL & MM_nextItem & Server.URLencode(Request.QueryString(MM_item))
215End If
216Next
217

218add the Form variables to the MM_keepForm string
219For Each MM_item In Request.Form
220MM_nextItem = "&" & MM_item & "="
221If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
222MM_keepForm = MM_keepForm & MM_nextItem & Server.URLencode(Request.Form(MM_item))
223End If
224Next
225

226create the Form + URL string and remove the intial '&' from each of the strings
227MM_keepBoth = MM_keepURL & MM_keepForm
228If (MM_keepBoth <> "") Then
229MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
230End If
231If (MM_keepURL <> "") Then
232MM_keepURL = Right(MM_keepURL, Len(MM_keepURL) - 1)
233End If
234If (MM_keepForm <> "") Then
235MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)
236End If
237

238a utility function used for adding additional parameters to these strings
239Function MM_joinChar(firstItem)
240If (firstItem <> "") Then
241MM_joinChar = "&"
242Else
243MM_joinChar = ""
244End If
245End Function
246%>
247<%
248*** Move To Record: set the strings for the first, last, next, and previous links
249

250Dim MM_keepMove
251Dim MM_moveParam
252Dim MM_moveFirst
253Dim MM_moveLast
254Dim MM_moveNext
255Dim MM_movePrev
256

257Dim MM_urlStr
258Dim MM_paramList
259Dim MM_paramIndex
260Dim MM_nextParam
261

262MM_keepMove = MM_keepBoth
263MM_moveParam = "index"
264

265if the page has a repeated region, remove 'offset' from the maintained parameters
266If (MM_size > 1) Then
267MM_moveParam = "offset"
268If (MM_keepMove <> "") Then
269MM_paramList = Split(MM_keepMove, "&")
270MM_keepMove = ""
271For MM_paramIndex = 0 To UBound(MM_paramList)
272MM_nextParam = Left(MM_paramList(MM_paramIndex), InStr(MM_paramList(MM_paramIndex),"=") - 1)
273If (StrComp(MM_nextParam,MM_moveParam,1) <> 0) Then
274MM_keepMove = MM_keepMove & "&" & MM_paramList(MM_paramIndex)
275End If
276Next
277If (MM_keepMove <> "") Then
278MM_keepMove = Right(MM_keepMove, Len(MM_keepMove) - 1)
279End If
280End If
281End If
282

283set the strings for the move to links
284If (MM_keepMove <> "") Then
285MM_keepMove = MM_keepMove & "&"
286End If
287

288MM_urlStr = Request.ServerVariables("URL") & "?" & MM_keepMove & MM_moveParam & "="
289

290MM_moveFirst = MM_urlStr & "0"
291MM_moveLast = MM_urlStr & "-1"
292MM_moveNext = MM_urlStr & CStr(MM_offset + MM_size)
293If (MM_offset - MM_size < 0) Then
294MM_movePrev = MM_urlStr & "0"
295Else
296MM_movePrev = MM_urlStr & CStr(MM_offset - MM_size)
297End If
298%>
299<html>
300<head>
301<title>London Adult Online Community</title>
302<!-- meta information for search engines -->
303<meta name="generator" content="Nucleus CMS v3.32" />
304<meta name="name" content="London Adult Online Community" />
305<meta name="description" content="" />
306<link rel="bookmark" title="Nucleus" href="http://nucleuscms.org/" />
307<link rel="archives" title="Archives" href="index.htm?archivelist=1" />
308<link rel="top" title="Today" href="index.htm?blogid=1" />
309<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
310</head>
311

312<body>
313<table width="866" border="2" cellpadding="3" cellspacing="0" bordercolor="#CCCCCC">
314<tr>
315<td width="500" bgcolor="#0099FF"><div align="center"><strong><font color="#FFFFFF" size="4" face="Verdana, Arial, Helvetica, sans-serif">LONDON
316ADULT ONLINE COMMUNITY</font></strong></div></td>
317<td width="125"><img src="lOGO/ben.jpg" width="146" height="115" /></td>
318<td width="125"><img src="lOGO/Parliament.jpg" width="150" height="115" /></td>
319<td width="125"><img src="lOGO/Tower%20Bridge.jpg" width="135" height="115" /></td>
320</tr>
321</table>
322</p>
323<p>&nbsp;
324<table width="866" border="2" cellpadding="3" cellspacing="0" bgcolor="#0099FF">
325<tr>
326<td width="280"><font color="#333333"><strong><a href="LondonAdultOnlineCommunityHomePage.asp">Home </a></strong></font></td>
327<td width="280"><font color="#333333"><strong><a href="Classified%20Advert%20Homepage.asp">Classifi ed
328Advert</a></strong></font></td>
329<td width="280"><font color="#333333"><strong><a href="Classified%20Advert.asp">Place
330an Advert</a></strong></font></td>
331<td width="280"><font color="#333333"><strong><a href="Classified%20Advert%20Search%20Return.asp">S earch
332Classified Adverts</a></strong></font></td>
333</tr>
334</table>
335<table width="866" height="55" border="2" cellpadding="3" cellspacing="0" bgcolor="#33FF33">
336<tr>
337<td width="247" height="51" bgcolor="#33FF33"> <form method="get" action="index.htm">
338<div class="searchform"> <strong>
339<input type="hidden" name="amount" value="0" />
340<input type="hidden" name="blogid" value="1" />
341<input name="query" alt="Keywords to search" class="formfield" size="10" maxlength="60" accesskey="4" value="" />
342<input name="submit" type="submit" class="formbutton" value="Search" alt="Search" />
343</strong></div>
344</form></td>
345<td width="78" height="51" valign="top" bgcolor="#33FF33"><font color="#333333"><strong><font color="#333333"><strong><a href="log%20in.asp">Login</a></strong></font></strong></font></td>
346<td width="119" height="51" valign="top" bgcolor="#33FF33"><font color="#333333"><strong><font color="#333333"><strong><a href="membership%20registration.asp">Membership</a>
347</strong></font></strong></font></td>
348<td width="133" height="51" align="right" valign="top" bgcolor="#33FF33"><font color="#333333"><font color="#333333"><strong>Font
349Size </strong></font></font></td>
350<td width="73" height="51" border="2"> <form class="accessiblity textSmall" method="post" action="Accessibility%20Statement.htm">
351<input type="hidden" name="TextSize2" value="small"/>
352<font color="#333333"><strong>
353<input name="submit2" type="submit" value="Small"/>
354</strong></font> </form></td>
355<td width="84" height="51" border="2"> <form class="accessiblity textMedium" method="post" action="/Accessibility%20Statementmeduim.htm">
356<font color="#333333"><strong>
357<input type="hidden" name="TextSize" value="medium"/>
358<input name="submit3" type="submit" value="Medium"/>
359</strong><font size=""></font></font> </form></td>
360<td width="72" height="51"> <form class="accessiblity textLarge" method="post" action="Accessibility%20Statement.htm">
361<font color="#33FF33"><strong>
362<input type="hidden" name="TextSize" value="large"/>
363<input name="submit4" type="submit" value="Large"/>
364</strong></font> </form></td>
365</tr>
366</table>
367<p>&nbsp;</p>
368<p><font color="#333333">Search and view the free London Adult Online Community
369Classified Adverts </font> </p>
370<p><font color="#333333">All of our Classified content are easily accessible and
371online</font></p>
372<p><font color="#333333">You can see anything in our classified adverts, Buy tables,
373sofas, fridges, television online</font></p>
374<p><font color="#333333"> </font></p>
375<p><font size="4"><strong>Search Classified Adverts</strong></font></p>
376<form action="" method="post" name="Advert" id="Advert">
377<table width="866" border="2" cellpadding="3" cellspacing="0">
378<tr>
379<td width="200" height="25" bgcolor="#00CCFF"><A HREF="<%=MM_moveFirst%>"><strong>First</strong></A></td>
380
<td width="200" height="25" bgcolor="#00FF66"><a href="<%=MM_movePrev%>"><font color="#333333"><strong>Previous</strong></font></a></td>381
<td width="200" height="25" bgcolor="#00CCFF"><a href="<%=MM_moveNext%>"><strong>Next</strong></a></td>382<td width="200" bgcolor="#00FF66"><A HREF="<%=MM_moveLast%>"><strong>Last</strong></A></td>
383</table>
384
<p>&nbsp;</p>385<table width="866" border="2" cellpadding="3" cellspacing="0">
386<tr>
387<td width="200" height="25" bgcolor="#00CCFF"><font color="#333333">Item</font></td>
388<td width="200" height="25" bgcolor="#00FF66"><font color="#333333"><%=(Recordset1.Fields.Item("Item") .Value)%></font></td>
389<td width="200" height="25" bgcolor="#00CCFF"><font color="#333333">Category
390Type</font></td>
391<td width="200" bgcolor="#00FF66"><font color="#333333"><%=(Recordset1.Fields.Item("Catego ry Type").Value)%> </font></td>
392</table>
393<table width="866" border="2" cellpadding="3" cellspacing="0">
394<tr>
395<td width="200" height="50" valign="top" bgcolor="#00CCFF"><font color="#333333">Photo</font></td>
396<td width="200" bgcolor="#00FF66"><font color="#333333"><%=(Recordset1.Fields.Item("Photo" ).Value)%></font> </td>
397
<td width="200" valign="top" bgcolor="#00CCFF"><font color="#333333">Description 398</font></td>
399
<td width="200" bgcolor="#00FF66"><font color="#333333"><%=(Recordset1.Fields.Item("Descri ption").Value)%></font> </td>400</table>
401<table width="866" border="2" cellpadding="3" cellspacing="0">
402<tr>
403<td width="200" height="25" bgcolor="#00CCFF"><font color="#333333">Price</font></td>
404<td width="200" bgcolor="#00FF66"><font color="#333333"><%=(Recordset1.Fields.Item("Price" ).Value)%></font> </td>
405
<td width="200" bgcolor="#00CCFF"><font color="#333333">Town </font></td>406
<td width="200" bgcolor="#00FF66"><font color="#333333"><%=(Recordset1.Fields.Item("Town") .Value)%></font> </td>407</table>
408<table width="866" border="2" cellpadding="3" cellspacing="0">
409<tr>
410<td width="200" height="25" bgcolor="#00CCFF"><font color="#333333">Contact
411Details</font></td>
412<td width="200" bgcolor="#00FF66"><font color="#333333"><%=(Recordset1.Fields.Item("Contac t Details").Value)%> </font></td>
413<td width="200" bgcolor="#00CCFF"><font color="#333333">Publish Date </font></td>
414<td width="200" bgcolor="#00FF66"><font color="#333333"><%=(Recordset1.Fields.Item("Publis h Date").Value)%> </font></td>
415</table>
416</form>
417<p>&nbsp;</p>
418<table width="866" border="2" cellpadding="3" cellspacing="0">
419<tr>
420<td width="125" height="75" ><a href="http://www.ivillage.co.uk/homegarden"><img src="lOGO/iVillage_logo1.jpg" width="370" height="100" border="0"></a></td>
421<td width="125"><a href="http://www.loot.com/"><img src="lOGO/loots%20logo.gif" width="154" height="91" border="0"></a></td>
422
<td width="150"><a href="http://www.cargiant.co.uk/"><img src="lOGO/car%20giant.gif" width="216" height="117" border="0"></a></td>423
</table>424<p>&nbsp;</p>
425

426<table width="866" border="2" cellpadding="3" cellspacing="0">
427<tr>
428<td width="125"><strong><font color="#333333"><a href="Mission%20Statement.htm">Mission
429Statement</a></font></strong></td>
430<td width="125"><strong><font color="#333333"><a href="Contact%20Us.asp">Contact
431us</a></font></strong></td>
432<td width="125"><strong><font color="#333333"><a href="Terms%20and%20Conditions.htm">Terms
433&amp; Conditions</a></font></strong></td>
434<td width="125"><strong><font color="#333333"><a href="Privacy%20Policy.htm">Privacy
435Policy</a></font></strong></td>
436<td width="125"><strong><font color="#333333"><a href="Accessibility%20Statement.htm">Accessibility </a></font></strong></td>
437</table>
438Copyright &copy; 2009 by London Adult Online Community. All Rights Reserved </p>
439</body>
440</html>
441<%
442Recordset1.Close()
443Set Recordset1 = Nothing
444%>

User is offlineProfile CardPM
+Quote Post

woodjom

RE: ASP Programming Problem

23 Jun, 2009 - 06:43 PM
Post #6

D.I.C Regular
Group Icon

Joined: 8 May, 2008
Posts: 365



Thanked: 15 times
My Contributions
give me some time....you didnt need to remove those 2 lines just reposition them after you have executed the query and placed the result in a RecordSet or Table for storage for displaying.
User is offlineProfile CardPM
+Quote Post

lakshus

RE: ASP Programming Problem

26 Jun, 2009 - 04:43 AM
Post #7

New D.I.C Head
*

Joined: 27 May, 2009
Posts: 3

CODE
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    
11                  
12    Create an ADO RecordSet object  
    ^Hope this is a comment above  

13    Set Recordset1 = Server.CreateObject("ADODB.Recordset")
    ^What connection are you using for this Recordset1?                        

14    Recordset1.Source = "SELECT * FROM Table1"                        
15    Recordset1.CursorType = 0                        
16    Recordset1.CursorLocation = 2                        
17    Recordset1.LockType = 1                        
18                            
19                            
20    Recordset1_numRows = 0
    ^This needs to be put into a variable otherwise you will get an error
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



Please check your table all fields names are entered correct.

or otherwise your problem is in recordset CursorType movements please chk that alos once again


http://knock-in.com
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/7/09 10:42PM

Live ASP.NET Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

ASP.NET Tutorials

Reference Sheets

ASP.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month