How many records do I have in database table
Published on 2/22/2008 by editor|
Vote this tutorial:
|
More articles in ASP
Sometimes we worry about limits of database table and we need to know how manay recods we have. In ASP we could count all recods using a loop. But if we have a small piece of knowledge about SQL script, our script works better and faster.
In the start of our script, no need to write so much codes. All work will be done in an SQL script. Here is all code.
<%
set con = server.createobject("adodb.connection")
strCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("/db/mydb.mdb")
set rec = con.execute("select count(*) from mytable")
response.write rec(0)
%>
Yellow marked part of code is important which part displays count of records in our database.
Have a nice coding and keep visiting us back !
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


