比较奇怪的是启动初始只能获取第一个表(GetRows)的信息,第二个表(GetRows)的信息无法获取。高手指点一下是怎么回事?代码如下:
Sub Application_OnStart
dim conn, rs, dbpath
dbpath="faqonline/images/#book8f5e4g3cg4hr6f.mdb" '数据库路径
On Error Resume Next
If Err Then Err.Clear
Set conn=Server.CreateObject("ADODB.Connection")
conn.Open "Provider = Microsoft.Jet.OLEDB.4.0;Data Source = " & Server.MapPath(dbpath)
If Err Then
Err.Clear
Set conn=Nothing
Response.Write "<center><font color=red>抱歉,数据库连接出错,请检查连接文件。</font></center>"
Response.End
End If
set rs = server.CreateObject("ADODB.RecordSet")
rs.open "select id,title,time from news order by time DESC",conn,3,3
Application("NewsList")=rs.GetRows()
Application("NewsCount")=rs.RecordCount
rs.close
set rs = nothing
set rs=server.CreateObject("ADODB.RecordSet")
rs.open "select id,title,subject,time from work_by_teacher order by time DESC",conn,3,3
Application("WorkList")=rs.GetRows()
Application("WorkCount")=rs.RecordCount
rs.close
set rs = nothing
conn.close
set conn = nothing
End Sub
Sub Application_OnStart
dim conn, rs, dbpath
dbpath="faqonline/images/#book8f5e4g3cg4hr6f.mdb" '数据库路径
On Error Resume Next
If Err Then Err.Clear
Set conn=Server.CreateObject("ADODB.Connection")
conn.Open "Provider = Microsoft.Jet.OLEDB.4.0;Data Source = " & Server.MapPath(dbpath)
If Err Then
Err.Clear
Set conn=Nothing
Response.Write "<center><font color=red>抱歉,数据库连接出错,请检查连接文件。</font></center>"
Response.End
End If
set rs = server.CreateObject("ADODB.RecordSet")
rs.open "select id,title,time from news order by time DESC",conn,3,3
Application("NewsList")=rs.GetRows()
Application("NewsCount")=rs.RecordCount
rs.close
set rs = nothing
set rs=server.CreateObject("ADODB.RecordSet")
rs.open "select id,title,subject,time from work_by_teacher order by time DESC",conn,3,3
Application("WorkList")=rs.GetRows()
Application("WorkCount")=rs.RecordCount
rs.close
set rs = nothing
conn.close
set conn = nothing
End Sub
解决方案 »
- 怎么禁止文本框输入中文??急..往赐教
- 好象没人问这个问题
- SQL2008中数据表的删除
- 一个存储过程,高人指点
- 100分---求如何在内容页动态更改母模板中一个div的背景图片? ---给出代码,马上给分!
- datagrid,又见datagrid!!!
- 问一个很急的Fckeditor问题 急!急!急!同时也祝各位男士<三八>节快乐
- 急:<pages pageBaseType="NewBasePage" />到底是什么意思?请高手给指点一下
- 为什么我的ASP.NET MVC4程序View在输出的时候直接输出Model的成员名?
- web控件中没找到treeview控件怎么办?哪里有?
- c#中的数据传送到前台
- 项目中遇到的两个问题
建两个对象!!
rs和rs1试试!!
2种可能:
1:请查看第2个表中是否有数据。
2:asp的错误机制不太人性化。(有的错误它不提示,但依然存在。特别是操作数据库的时候。荤)