How many records do I have in database table
Vote this news:
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

