ASP/Access DB/FrontPage帮助 [英] ASP / Access DB / FrontPage Help

查看:72
本文介绍了ASP/Access DB/FrontPage帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!
我在Frontpage中创建了一个页面,并将表单发布到Access数据库.我想计算某种类型的记录数.我在网上搜索并找到了一些代码示例,但无法获取要显示的信息.没有错误消息,只是没有信息.
我的访问数据库已发布到标准fpdb目录下的Web服务器.这就是结果.
这是我的ASP代码

数据库是fpdb目录下的index.mdb.表是结果.

<%
''尺寸变量
昏暗的conn"持有数据库连接对象
Dim rs''为数据库中的记录保留记录集
Dim strSQL''保留SQL查询以查询数据库
昏暗的rc
昏暗的myCount
set conn = Server.CreateObject("ADODB.Connection")
conn.Provider ="Microsoft.Jet.OLEDB.4.0"
conn.Open(Server.Mappath("index.mdb"))
设置rs = Server.CreateObject("ADODB.Recordset")
strSQL =在结果类别=开胃菜"中从结果中选择COUNT(*)myCount"
rs.Open结果",strSQL,conn
rc = rs("myCount")
rs.Close
conn.Close
设置rs = Nothing
设置conn = Nothing
%>

在HTML页面中,这是我用来打印结果的代码.
<%response.write"App Total ="& rc%>

它写入App Total,仅在=号后没有值.
gh!

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!

推荐答案

应该不是"SELECT COUNT(*) AS myCount"吗?

自从我做完旧的ASP以来已经很久了,我不记得它是否应该通过例外处理.
Shouldn''t it be "SELECT COUNT(*) AS myCount"?

It''s so long since I''ve done old ASP that I do not remember, whether it should through an exception in that case or not.


这篇关于ASP/Access DB/FrontPage帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆