Hi!
I have a page I created in Frontpage with a form posting to an access database. I want to count the number of records that are of a certain type. I've search the web and found some code examples, but can't get the information to display. No error messages, just no information.
My access database is published to the webserver under the standard fpdb directory. It's called Results.
Here is my ASP code
Database is index.mdb under the fpdb directory. Table is Results.
<%
'Dimension variables
Dim conn 'Holds the Database Connection Object
Dim rs 'Holds the recordset for the records in the database
Dim strSQL 'Holds the SQL query to query the database
Dim rc
Dim myCount
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open(Server.Mappath("index.mdb"))
Set rs = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT COUNT(*) myCount FROM Results WHERE Category='Appetizer'"
rs.Open "Results", strSQL, conn
rc=rs("myCount")
rs.Close
conn.Close
Set rs=Nothing
Set conn=Nothing
%>
In HTML page here is the code I use to print out results.
<%response.write "App Total = " & rc%>
It writes App Total, just no value after the = sign.
Ugh!
Help anybody!