数据库连接出错,请检查数据库名称及路径是否正确。<%@LANGUAGE ="VBScript.Encode" CODEPAGE="936"%>

来源:百度知道 编辑:UC知道 时间:2024/05/28 19:48:18
<%@LANGUAGE ="VBScript.Encode" CODEPAGE="936"%>
<!--#include file="Config.asp"-->
<!--#include file="Function.asp"-->
<%
Response.charset="gb2312"
dim conn,connstr,Data
if SqlNo =1 then
On error resume next
Set Conn=Server.CreateObject("Adodb.Connection")
ConnStr="PROVIDER=SQLOLEDB;DATA SOURCE=3325A06D8;UID=sa;PWD=;DATABASE=ZhiRui"
Conn.open ConnStr
else
Data=""&SitePath&"DataBase/"&DataName&""
on error resume next
Set conn = Server.CreateObject("ADODB.Connection")
connstr="dbq="+server.mappath(Data)+";defaultdir=;driver={microsoft access driver (*.mdb)};uid=;password="&Uidv&";"
conn.Open connstr
end if

If Err Then
err.Clear
Set Conn = Nothing
Response.Write "<div style='margin:100px;fon

数据库路径应该在
<!--#include file="Config.asp"-->中,
在Config.asp中寻找
SitePath应该是网站的路径
DataBase应该是数据库目录
DataName应该属数据库名字
关于路径设置请看下面例子:
以下是路径的分类:
1。相对路径,例:“../a.htm”或“a.html”
2。绝对根路径 例:“/a.htm”
3。绝对全路径 例:“http://www.0371rencai.net/zhaopin.php

希望对楼主有帮助

我晕啊,代码不完整,无法看出问题来的

还有些include的东西没贴出来呢

好好检查一下你数据库链路径