Filtering results from database
Published on 11/16/2008 by Dotnetindex|
Vote this tutorial:
|
More articles in ASP
Filter method is very useful working with large datasets. You might need to put only some records from your database but you should select all data from database. Fileter method is advantage working on recordsets after querying on SQL command.
Let's see what's going on a fresh example :
<%
Const adFilterNone = 0
Const adFilterPendingRecords = 1
Const adFilterAffectedRecords = 2
Const adFilterFetchedRecords = 3
Const adFilterConflictingRecords = 5
Set rs = server.CreateObject("adodb.recordset")
cn = "Provider=SQLOLEDB;Data Source=virtualShop.gazatem.com;database=VirtualShop;uid=SA;pwd=;"
sql = "select * from virtualShop_Products order by productID desc;"
rs.open sql, cn, 3, 3
rs.FILTER = "stock < 2"response.write "Low stock stock :
"
do while not rs.eof
response.write rs("productTitle") & ":" & rs("stock") & "
"
rs.movenext
loop
rs.Filter = adFilterNone
rs.FILTER = "stock > 5"
response.write "High stock report :
"
do while not rs.eof
response.write rs("productTitle") & ":" & rs("stock") & "
"
rs.movenext
loop
%>
Happy Coding !
Comments:
no comments submitted
Latest Posts
- Create and retrieve cookies
- Easy Error Handling in C#
- Filtering results from database
- Filling Data into Select List
- Working with Array Remove An Item
- Custom Paging in ASP Fast And Easy
- Display Top N records from MS Access
- Using GetRows To Get All Records From Table
- VBScript Functions The Len Function
- Free User Registration Form
- Copying Folders using File System Object
- ArrayList object usage with example
- Using SUM Function in An SQL Statement
- Compacting an Access database from ASP code
- Database Driven Login Script
- Methods of Session Object
- Simple XMLRSS Parser Part-II
- Selecting random record from database
- Image downloading from remote servers in ASP
- How to Encrypt String Using MD5


