codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Count in an SQL query  Archive Import (Josh) at 20:39 on Wednesday, June 11, 2003
 

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>

  Re: Count in an SQL query  Yusairi at 09:34 on Monday, July 07, 2003
 

what is the problem with your code ?.


  Re: Count in an SQL query  Yusairi at 09:40 on Monday, July 07, 2003
 

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


  Re: Count in an SQL query  Yusairi at 10:01 on Monday, July 07, 2003
 

or

replace
<%=textCount%>
with
<%=[textCount]%>

@Life at http://www.vss.com.my








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  C# excel library
•  Re: open excel file in html page
•  asp.net excel
•  Cracked software ftp download 2013
•  Latest crack software ftp download
•  Famous Software ftp download 2013
•  deleting data from databse to dropdown list
•  matrix addition
•  Re: Storing data from HTML to Excel or TXT


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2013