conn.asp 文件打开要怎么链接数据库呢
<!--#includefile="SETTINGS.ASP"--><!--#includefile="xinhai.asp"--><%dimcon,rs,sqlstr,...
<!--#include file="SETTINGS.ASP" -->
<!--#include file="xinhai.asp" -->
<%
dim con,rs,sqlstr,sql
On Error Resume Next
Set con=New xinhai_database
if err then response.redirect "error.asp?errstr=" & Server.urlencode("您可能尚未安装或者安装没有完成,请点击这里进行[<a href='setup.htm'>安装</a>]。")
On Error Goto 0
con.dbPath=pasdbpath
con.OpenDatabase
Sub conBatchExecute(str)
Dim i
If IsArray(str) Then
For i=0 To UBound(str)
con.execute(str(i))
Next
Else
con.execute(str)
End If
End Sub
Function getFenyeRs(str)
set getFenyeRs=con.exec(str,2)
End Function
%> 展开
<!--#include file="xinhai.asp" -->
<%
dim con,rs,sqlstr,sql
On Error Resume Next
Set con=New xinhai_database
if err then response.redirect "error.asp?errstr=" & Server.urlencode("您可能尚未安装或者安装没有完成,请点击这里进行[<a href='setup.htm'>安装</a>]。")
On Error Goto 0
con.dbPath=pasdbpath
con.OpenDatabase
Sub conBatchExecute(str)
Dim i
If IsArray(str) Then
For i=0 To UBound(str)
con.execute(str(i))
Next
Else
con.execute(str)
End If
End Sub
Function getFenyeRs(str)
set getFenyeRs=con.exec(str,2)
End Function
%> 展开
1个回答
展开全部
<%
'功能:连接Access数据库
Dim Db,Connstr
Db="./DataBase/%#Swf.mdb" '数据库路径
Connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.MapPath(Db)
On Error resume next
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.open Connstr
If Err then
err.clear
set Conn=nothing
response.Write("connect database error")
response.End()
End If
%>
'功能:连接Access数据库
Dim Db,Connstr
Db="./DataBase/%#Swf.mdb" '数据库路径
Connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.MapPath(Db)
On Error resume next
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.open Connstr
If Err then
err.clear
set Conn=nothing
response.Write("connect database error")
response.End()
End If
%>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询