Experiment Recordset. Movenext, Recordset. Previous, Recorset...

Source: Internet
Author: User
I am experimenting with Recordset. movenext, Recordset. PRevious, Recorset ....... it is difficult to move the records. I use access as a background database and obtain a record set through a query condition. I want to use a table to view records one by one (not a group of records ). that is, a total of ** records are found.

I am experimenting with Recordset. movenext, Recordset. PRevious, Recorset ....... it is difficult to move the records. I use access as a background database and obtain a record set through a query condition. I want to use a table to view records one by one (not a group of records ). that is, a total of ** records are found.

On LabRecordset. Movenext, Recordset. PRevious, Recorset... Mobile RecordEncountered difficulties.
I use access as the background database and obtain a query condition. RecordSet, I want to use a table to implement Record(Not a group) RecordPage browsing). That is, "A total of ** items are found. Record, Now is the * th ", click" Next "Next RecordIs displayed in the table .....

Use the following code (see the final section)

It is found that the query condition obtained from a Form from a table where in Rst. Open "select * from"
After changing to Rst. Open "select * from a table" (equivalent to not performing the query operation, Record.
Otherwise, there will always be an error message "EOF or BOF is true". You can select... where... "from" A table "to several RecordOf!

In short, how" RecordIn combination with "select * from a table where query conditions obtained from a Form?

Hope to give some guidance!

Yang Li
2000/4/13

Program code:

<% @ LANGUAGE = VBScript %>






Now you can edit the followingRecord

<%
'Create and open the Connection object.
Set cn = Server. CreateObject ("ADODB. Connection ")
Cn. Open "DSN = database name"
'Create and open the Recordset object.
Set Rst = Server. CreateObject ("ADODB. Recordset ")
Rst. ActiveConnection = cn
Rst. CursorType = adOpenKeyset
Rst. LockType = adLockOptimistic
Rst. Open "select * from a table where gender = '" & request. form ("t1") & "'" (it is very difficult to execute this sentence)
Rst. Open "select * from a table where gender = 'male'" (this statement is a problem)
Rst. Open "select * from hr_base" (this statement is correct)
'Check the Request. Form collection to view RecordAny Mobile.
If Not IsEmpty (Request. Form ("MoveAmount") Then
' MobileNumber and direction.
Session ("Moves") = Session ("Moves") + Request. Form ("MoveAmount ")
Clicks = Session ("Moves ")
' MobileTo the previous known location.
Rst. Move CInt (Clicks)
'Check Mobile+ Or-and perform error check.
If CInt (Request. Form ("MoveAmount") = 1 Then
If Rst. EOF Then
Session ("Moves") = Rst. RecordCount
Rst. MoveLast
End If
Rst. MoveNext
End If
If Request. Form ("MoveAmount") <1 Then
Rst. MovePrevious
End If
'Check whether the First Record or Last Record command button is clicked.
If Request. Form ("MoveLast") = 3 Then
Rst. MoveLast
Session ("Moves") = Rst. RecordCount
End If
If Request. Form ("MoveFirst") = 2 Then
Rst. MoveFirst
Session ("Moves") = 1
End If
End If
'Click the combination of Move buttons for error check.
If Rst. EOF Then
Session ("Moves") = Rst. RecordCount
Rst. MoveLast
Response. Write "This is the Last Record"
End If
If Rst. BOF Then
Session ("Moves") = 1
Rst. MoveFirst
Response. Write "This is the First Record"
End If
%>

<% = Rst. RecordCount %> found in total Record, Current is

<%
If IsEmpty (Session ("Moves") Then
Session ("Moves") = 1
End If
%>
<% Response. Write (Session ("Moves") %>
Entries Record

 > Type = "button" Name = "cmdUp" Value = "Next">Value = "Last entry">

                                  

Query results:

                    
                    

Record
(Used for display one by oneTable)
 
                  
                                   
                  
                  

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.