asp数据库通过SUB连接出现问题!
conn.asp内容如下=================================================PublicSubmdbinfo()OnErro...
conn.asp内容如下
=================================================
Public Sub mdbinfo()
On Error Resume Next
dim db_info,conn_info
Db_info = "data/#info_2006#.mdb"
Set conn_info = Server.CreateObject("ADODB.Connection")
conn_info.open "Provider = Microsoft.Jet.OLEDB.4.0;Data Source = " & Server.MapPath(db_info)
If Err Then
err.Clear
Set conn_info = Nothing
Response.Write "资讯数据库连接出错,请检查。并和管理员联系!"
Response.End
End If
End Sub
=================================================
info.asp头部内容如下
=================================================
<!--#include file="conn.asp" -->
<%
dim rs
call info()
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from 资讯",conn_info,1,1
=================================================
系统提示:错误类型:
Microsoft VBScript 运行时错误 (0x800A01F4)
变量未定义: 'conn_info'
info.asp, 第 6 行
经测试
在 Info.asp 页面 response.write conn_info 为空!
在 conn.asp 页面 response.write conn_info 为连接信息!
特来求助!
刚才写错了一句话!
过程开始是 Sub info()
不是现在写的那个Public Sub mdbinfo() 展开
=================================================
Public Sub mdbinfo()
On Error Resume Next
dim db_info,conn_info
Db_info = "data/#info_2006#.mdb"
Set conn_info = Server.CreateObject("ADODB.Connection")
conn_info.open "Provider = Microsoft.Jet.OLEDB.4.0;Data Source = " & Server.MapPath(db_info)
If Err Then
err.Clear
Set conn_info = Nothing
Response.Write "资讯数据库连接出错,请检查。并和管理员联系!"
Response.End
End If
End Sub
=================================================
info.asp头部内容如下
=================================================
<!--#include file="conn.asp" -->
<%
dim rs
call info()
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from 资讯",conn_info,1,1
=================================================
系统提示:错误类型:
Microsoft VBScript 运行时错误 (0x800A01F4)
变量未定义: 'conn_info'
info.asp, 第 6 行
经测试
在 Info.asp 页面 response.write conn_info 为空!
在 conn.asp 页面 response.write conn_info 为连接信息!
特来求助!
刚才写错了一句话!
过程开始是 Sub info()
不是现在写的那个Public Sub mdbinfo() 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询