⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 conn.asp

📁 网上购物系统
💻 ASP
字号:
<%
on error resume next
response.buffer=true '启用缓冲处理

'数据库路径请在此修改
Const DATABASE_PATH="data/#data.mdb"

Dim ShopPath
ShopPath=Server.MapPath("Conn.asp")
ShopPath=Left(ShopPath,Len(ShopPath)-Len("Conn.asp"))

Dim strDbPath
GetReallyDirectory()
strDbPath=ShopPath & DATABASE_PATH

Dim Conn
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDbPath
If Err Then
    err.Clear
    Set Conn = Nothing
    Response.Write "数据库连接出错,请检查数据库连接文件中的数据库参数设置。"
    Response.End
End If 

' 得到实际上的真实目录
Function GetReallyDirectory()
	On Error Resume Next
	Dim fso
	Set fso = CreateObject("Scripting.FileSystemObject")
	If fso.FileExists(ShopPath & "\" & DATABASE_PATH) Then
		ShopPath=ShopPath
	ElseIf fso.FileExists(ShopPath & "\..\" & DATABASE_PATH) Then
		ShopPath=ShopPath & "..\"
	ElseIf fso.FileExists(ShopPath & "\..\..\" & DATABASE_PATH) Then
		ShopPath=ShopPath & "..\..\"
	ElseIf fso.FileExists(ShopPath & "\..\..\..\" & DATABASE_PATH) Then
		ShopPath=ShopPath & "..\..\..\"
	ElseIf fso.FileExists(ShopPath & "\..\..\..\..\" & DATABASE_PATH) Then
		ShopPath=ShopPath & "..\..\..\..\"
	ElseIf fso.FileExists(ShopPath & "\..\..\..\..\..\" & DATABASE_PATH) Then
		ShopPath=ShopPath & "..\..\..\..\..\"
	End If
	Set fso=Nothing
	GetReallyDirectory=True
	Err.Clear
End Function
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -