我在 实验 Recordset.Movenext,Recordset.PRevious,Recorset.......等 移动 记录 的时候遇到了困难. 我用access做后台数据库,通过一个查询条件查询得一个 记录 集,我想用一个表格实现 记录 的逐条浏览(不是一组 记录 分页浏览). 即共查到**条 记录 ,现在是第
我在实验Recordset.Movenext,Recordset.PRevious,Recorset.......等移动记录的时候遇到了困难.我用access做后台数据库,通过一个查询条件查询得一个记录集,我想用一个表格实现记录的逐条浏览(不是一组记录分页浏览). 即"共查到**条记录,现在是第*条",单击"Next"按钮后下一条记录的内容显示在表格中.....
我用如下代码实现(见最后)
发现若将Rst.Open "select * from 某表 where 从某个Form获取的查询条件"
改成 Rst.Open "select * from 某表"(相当于不做查询动作)后, 记录的浏览功能才得以实现.
否则总是出现" EOF或BOF为真 "的错误提示.可我明明可以从"某表"中 "select... where..."到好几个记录的!
总之如何将"记录的逐条浏览"和"select * from 某表 where 从某个Form获取的查询条件" 结合起来?
望予以指点为感!
杨利
2000/4/13
程序代码:
现在您可以编辑以下记录
'创建并打开 Connection 对象。
Set cn=Server.CreateObject("ADODB.Connection")
cn.Open "DSN=数据库名"
'创建并打开 Recordset 对象。
Set Rst = Server.CreateObject("ADODB.Recordset")
Rst.ActiveConnection = cn
Rst.CursorType = adOpenKeyset
Rst.LockType = adLockOptimistic
Rst.Open "select * from 某表 where 性别='"&request.form("t1")&"'"(执行这句大有问题)
Rst.Open "select * from 某表 where 性别='男'"(执行这句有点问题)
Rst.Open "select * from hr_base"(执行这句没有问题)
' 检查 Request.Form 集合以查看所记录的任何移动。
If Not IsEmpty(Request.Form("MoveAmount")) Then
' 跟踪该会话的移动数目和方向。
session("Moves") = Session("Moves") + Request.Form("MoveAmount")
Clicks = Session("Moves")
'移动到上一个已知位置。
Rst.Move CInt(Clicks)
'检查移动为 + 还是 - 并进行错误检查。
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") Rst.MovePrevious
End If
'检查有无单击 First Record 或 Last Record 命令按钮。
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
' 对 Move Button 单击组合进行错误检查。
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
%>
共查到条记录,当前为第
If IsEmpty(Session("Moves")) Then
Session("Moves") =1
End If
%>
条记录
> Type="button" Name="cmdUp" Value="下一条"> Value="末一条">
查询结果:

MySQLviewshavelimitations:1)Theydon'tsupportallSQLoperations,restrictingdatamanipulationthroughviewswithjoinsorsubqueries.2)Theycanimpactperformance,especiallywithcomplexqueriesorlargedatasets.3)Viewsdon'tstoredata,potentiallyleadingtooutdatedinforma

ProperusermanagementinMySQLiscrucialforenhancingsecurityandensuringefficientdatabaseoperation.1)UseCREATEUSERtoaddusers,specifyingconnectionsourcewith@'localhost'or@'%'.2)GrantspecificprivilegeswithGRANT,usingleastprivilegeprincipletominimizerisks.3)

MySQLdoesn'timposeahardlimitontriggers,butpracticalfactorsdeterminetheireffectiveuse:1)Serverconfigurationimpactstriggermanagement;2)Complextriggersincreasesystemload;3)Largertablesslowtriggerperformance;4)Highconcurrencycancausetriggercontention;5)M

Yes,it'ssafetostoreBLOBdatainMySQL,butconsiderthesefactors:1)StorageSpace:BLOBscanconsumesignificantspace,potentiallyincreasingcostsandslowingperformance.2)Performance:LargerrowsizesduetoBLOBsmayslowdownqueries.3)BackupandRecovery:Theseprocessescanbe

Adding MySQL users through the PHP web interface can use MySQLi extensions. The steps are as follows: 1. Connect to the MySQL database and use the MySQLi extension. 2. Create a user, use the CREATEUSER statement, and use the PASSWORD() function to encrypt the password. 3. Prevent SQL injection and use the mysqli_real_escape_string() function to process user input. 4. Assign permissions to new users and use the GRANT statement.

MySQL'sBLOBissuitableforstoringbinarydatawithinarelationaldatabase,whileNoSQLoptionslikeMongoDB,Redis,andCassandraofferflexible,scalablesolutionsforunstructureddata.BLOBissimplerbutcanslowdownperformancewithlargedata;NoSQLprovidesbetterscalabilityand

ToaddauserinMySQL,use:CREATEUSER'username'@'host'IDENTIFIEDBY'password';Here'showtodoitsecurely:1)Choosethehostcarefullytocontrolaccess.2)SetresourcelimitswithoptionslikeMAX_QUERIES_PER_HOUR.3)Usestrong,uniquepasswords.4)EnforceSSL/TLSconnectionswith

ToavoidcommonmistakeswithstringdatatypesinMySQL,understandstringtypenuances,choosetherighttype,andmanageencodingandcollationsettingseffectively.1)UseCHARforfixed-lengthstrings,VARCHARforvariable-length,andTEXT/BLOBforlargerdata.2)Setcorrectcharacters


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Zend Studio 13.0.1
Powerful PHP integrated development environment

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),
