请教如何引用数据库
web_syssource.rar
(78.84 KB)
请教为什么以下程序无法通过,我应该如何写才能引用附件中的web_syssource.asp数据库(在程序中我似乎找不到“db_path”)private sub class_initialize()
dim sqldb_name,sql_password,sql_username,sql_servername,db_path
''dbType等于"1"时表示引用SQL数据库,否则等于"0"时引用Access数据库
''sql_username、sql_password应在网站设置中定义
if dbType=1 then
sql_servername="(local)"
sqldb_name="web_sys"
sql_username="sa"
sql_password=""
conn_str="Provider = Sqloledb; User ID = " & sql_username & "; Password = " & sql_password & "; Initial Catalog = " & sqldb_name & "; Data Source = " & sql_servername & ";"
sql_nowstring="getdate()"
else
db_path=conn_dbpath
''conn_str="Provider = Microsoft.Jet.OLEDB.4.0;Data Source = " & Server.MapPath(db_path)
conn_str="Driver={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath(db_path)
sql_nowstring="now()"
end if
set conn_obj=server.createobject("adodb.connection")
set rs_obj=server.createobject("adodb.recordset")
end sub