|
I`m using an asp page that should count the number of records in a table and then display said information in the page. Can anyone help? My code:
<%
Dim datConn2, rsRecord2, textCount, SQL2
textCount = SQL2
set datConn2 = Server.CreateObject("ADODB.Connection")
set rsRecord2 = Server.CreateObject("ADODB.Recordset")
SQL2 = "SELECT COUNT(*) AS [textCount] FROM bexText"
datConn2.connectionstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\home\dailyev\data\egreenchat.mdb;"
datConn2.Open
rsRecord2.Open SQL2, datConn2
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
The Textbook Exchange
The place to buy and sell textbooks, with <%=textCount%> listings.
<%
rsRecord2.Close
datConn2.Close
set rsRecord2 = nothing
set datConn2 = nothing
%>
</body>
</html>
|
|
|
what is the problem with your code ?.
|
|
|
hi Josh...
replace
SQL2 = "SELECT COUNT(*) AS [textCount] FROM bexText"
to
`ID = prefer your primary field in table bexText.
SQL2 = "SELECT COUNT(ID) AS total FROM bexText"
finally, you can preview in <%=total%>
hopefully it work for you.
"Gain More Knowledge"
feel free to visit http://www.vss.com.my
|
|
|
|
|
|
|
|
|
|