最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
asp几种数据库连接方式
时间:2022-07-02 22:42:17 编辑:袖梨 来源:一聚教程网
asp几种数据库连接方式<%
'如果使用国外主页空间,请使用下面语句:'
'rem codepage="936" '
sqlkai=0
Dim SqlDatabaseName,SqlPassword,SqlUsername,SqlLocalName
SqlLocalName="(local)"
SqlUsername="nntoa"
SqlPassword="123456"
SqlDatabaseName="sqloa"
dim conn
dim connstr
dim db
'更改数据库名字'
if db="" then db="数据库路径"
'on error resume next
Set conn = Server.CreateObject("ADODB.Connection")
if err then
err.clear
Response.Write("
response.end
end if
'if sqlkai=1 then
'ConnStr = "Provider = Sqloledb; User ID = " & SqlUsername & "; Password = " & SqlPassword & "; Initial Catalog = " & SqlDatabaseName & "; Data Source = " & SqlLocalName & ";"
'else
'connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(""&db&"")&";Jet OLEDB:Database password="&nt80acmi&""
'end if
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db)
conn.Open connstr
if err then
err.clear
Response.Write("
response.end
end if
function connClose'关闭数据库
Conn.close
Set conn = Nothing
End Function
%>
相关文章
- 2025年8月XRP将迎来什么? 08-02
- 《阴阳师》“超鬼王”阿修罗阵容推荐分享 08-02
- 《奇迹暖暖》饴蜜迎春套装怎么获得方法有哪些 08-02
- 怎么驱动矿机-矿机怎么打驱动 08-02
- 《空之要塞:启航》阵容角色搭配最强推荐 08-02
- 《重返未来1999》洞悉机制有什么 08-02