Ads |
|
 |
|
Products |
|
 |
|
|
|
 |
 |
 |
|
|
 |
Count the records in a database
| |
| |
|
|
Count the records in a database
This could be useful if you wished to tell the users how many items were in your database , this could be users , items in a shop or links for example.
The file adovbs.inc is available here this merely contains a list of the constants that are available in a file , it saves a bit of typing. |
<!-- #include file = "adovbs.inc"-->
<%
'variables for our objects
Dim objRS , objConn
'create instances of our objects
Set objConn = Server.CreateObject("ADODB.Connection")
Set objRS = Server.CreateObject("ADODB.Recordset")
objConn.Open "DBQ=" & Server.MapPath("sampledb.mdb")& ";Driver={Microsoft Access Driver (*.mdb)}"
objRS.Open "tblsample" , objConn , adOpenStatic , adLockReadOnly , adCmdTable
'find available records and store them in a variable
AvailableRecords = objRS.RecordCount
'display available records
Response.Write "There are " & AvailableRecords & " available records in the table "
'tidy up by closing and deleting objects
objRS.Close
Set objRS = Nothing
Set objConn = Nothing
%> |
|
|
|
|
|
|
 |
 |
 |
Products |
|
 |
|
|
Comparison |
|
 |
|
|
Ads |
|
 |
|
|
|