'==================================================================建库
sub createdatabase()
dim DBName,dbstr,myCat
on error resume next
DBName = request("dataname")
dbstr = "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & DBName
Set myCat = Server.CreateObject( "ADOX.Catalog" )
myCat.Create dbstr
if err <> 0 then
response.write err.description
session("dbtype") = ""
session("dbstr") = ""
response.write "<input type='button' name='ok' value=' 返 回 ' onClick='javascript:history.go(-1)'>"
response.end
end if
session("dbtype") = "access"
session("dbstr") = dbstr
response.redirect "?"
end sub
'==================================================================调用链接函数
conn()
function conn()
dim conn1,connstr
on error resume next
select case session("dbtype")
case "access"
'==================================================================连接ACCESS数据库
connstr = session("dbstr")
Set Conn1 = Server.CreateObject("ADODB.Connection")
conn1.Open connstr
case "sql"
'==================================================================连接SQL数据库
set conn1 = Server.CreateObject("ADODB.Connection")
conn1.open session("dbstr")
end select
if err <> 0 then
response.write err.description
session("dbtype") = ""
session("dbstr") = ""
response.write "<input type='button' name='ok' value=' 返 回 ' onClick='javascript:history.go(-1)'>"
response.end
end if









