日期:2014-05-16 浏览次数:21742 次
'--连接名(SqlLocalName)(本地用(local),外地用IP)
Const SqlDatabaseName = "svdata"
Const SqlUsername = "sa"
Const SqlPassword = "123456"
Const SqlLocalName = "(local)"
'-------------------------------------------------------------------------------
'-----------------------ACCESS数据库连接参数------------------------------------
'--ACC数据库连接参数:数据库路径(Accessdb)
Const Accessdb="/#svdata#/svdata-base#.mdb"
'**************************************************************************************************************
If datatype=0 then '数据库类型为:ACCESS
connstr="DBQ="+server.mappath(Accessdb)+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
else '数据库类型为:MSSQL
connstr = "Provider = Sqloledb; User ID = " & SqlUsername & "; Password = " & SqlPassword & "; Initial Catalog = " & SqlDatabaseName & "; Data Source = " & SqlLocalName & ";"
End if
set conn=server.createobject("ADODB.CONNECTION")
conn.open connstr
If Err Then
err.Clear
Set Conn = Nothing
Response.Write "数据库连接出错,请检查数据库连接文件中的数据库参数设置。"
Response.End
End If