高分求教:ASP代码优化

l_walker 2001-11-25 03:13:46
我用ASP和ACCESS

一般的主机,怎么做代码优化,现在访问量一大就出问题,

哪位高手教教俺啊!!!!!!!!!!!!
...全文
120 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
netying 2001-11-26
  • 打赏
  • 举报
回复
guanzhu
superlyq007 2001-11-26
  • 打赏
  • 举报
回复
这样的代码到是新颖,值得一试
wiggler 2001-11-26
  • 打赏
  • 举报
回复
把access拆分开来!
不同的数据表就做成不同的数据库,不要全部放在一个数据库里面!
应该有一定的效果吧?
做一个数据库打开的过程:我在别人代码里学来的

Dim connbbs,conngbook,connmail,connnews,connphoto,connuser
Dim statbbs,statgbook,statmail,statnews,statphoto,statuser
Dim connstring,sql,rsbbs,rsgbook,rsmail,rsnews,rsphoto,rsuser

statuser=0 '数据库状态初始化
statbbs=0
statmail=0
statgbook=0
statphoto=0
statnews=0
'################################################################
'打开数据库过程,新的数据库按照格式添加
'################################################################
Sub OpenDB(dbname)
Select Case LCase(dbname)
Case "user"
If statuser=0 Then
Set connuser=server.CreateObject("adodb.connection")
connuser.open connstring & "/db_user.mdb"
End If
statuser=statuser+1
Case "bbs"
If statbbs=0 Then
Set connbbs=server.CreateObject("adodb.connection")
connbbs.open connstring & "/db_bbs.asp"
End If
statbbs=statbbs+1
Case "mail"
If statmail=0 Then
Set connmail=server.CreateObject("adodb.connection")
connmail.open connstring & "/db_mail.mdb"
End If
statmail=statmail+1
Case "gbook"
If statgbook=0 Then
Set conngbook=server.CreateObject("adodb.connection")
conngbook.open connstring & "/db_gbook.mdb"
End If
statgbook=statgbook+1
Case "photo"
If statphoto=0 Then
Set connphoto=server.CreateObject("adodb.connection")
connphoto.open connstring & "/db_photo.mdb"
End If
statphoto=statphoto+1
End Select
End Sub
'################################################################
'关闭数据库过程
'################################################################
Sub CloseDB(dbname)
Select Case LCase(dbname)
Case "user"
If statuser=1 Then
connuser.close
Set connuser=nothing
End If
statuser=statuser-1
Case "bbs"
If statbbs=1 Then
connbbs.close
Set connbbs=nothing
End If
statbbs=statbbs-1
Case "mail"
If statmail=1 Then
connmail.close
Set connmail=nothing
End If
statmail=statmail-1
Case "gbook"
If statgbook=1 Then
conngbook.close
Set conngbook=nothing
End If
statgbook=statgbook-1
Case "photo"
If statphoto=1 Then
connphoto.close
Set connphoto=nothing
End If
statphoto=statphoto-1
Case "news"
If statnews=1 Then
connnews.close
Set connnews=nothing
End If
statnews=statnews-1
End Select
End Sub
CommerceServer 2001-11-25
  • 打赏
  • 举报
回复
在连接数据库时前后要加上两句
Application.Lock
....操作数据库
Application.UnLock

Access功能太弱,本身就是桌面型数据库,不能两个同时访问,不是代码优化的问题。
freekei 2001-11-25
  • 打赏
  • 举报
回复
ACCESS不管在哪一方面与SQL SERVER都有十分大的差距,建设用SQL SERVER
l_walker 2001-11-25
  • 打赏
  • 举报
回复
兄弟们,我知道应该用MSSQL可是兄弟偶穷啊,买不起那空间啊:(

不得不用ACCESS,所以想问问有什么办法可以优化的?!!!

oldgameman 2001-11-25
  • 打赏
  • 举报
回复
please use SQL SERVER
jeff800614 2001-11-25
  • 打赏
  • 举报
回复
本质上这不是代码的问题。
ACCESS适用于桌面应用,在网络环境下,它不支持很多用户的并发访问。毕竟它不时数据库服务器。
还是使用SQL SERVER吧。
karma 2001-11-25
  • 打赏
  • 举报
回复
do not use Access, it is a personal database, not suitable in an Internet environment where a lot of users could visit it at the same time

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧