;
<%
response.End()
end if
''==================================================================建库
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
set conn = conn1
end function
Sub echo(str)
Response.Write(str)
End Sub
Function IIf(var, val1, val2)
If var = True Then
IIf = val1
Else
IIf = val2
End If
End Function
''正则表达式函数,用于删除注释
''-------------------------------------
Function RegExpReplace(strng, patrn, replStr)
Dim regEx,match,matches '' 建立变量。
Set regEx = New RegExp '' 建立正则表达式。
regEx.Pattern = patrn '' 设置模式。
regEx.IgnoreCase = True '' 设置是否区分大小写。
regEx.Global = True '' 设置全局可用性。
RegExpReplace = regEx.Replace(strng, replStr) '' 作替换。
End Function
''==================================================================ADOVBS 常量声明
''---- DataTypeEnum Values ----
Const adEmpty = 0
Const adTinyInt = 16
Const adSmallInt = 2
Const adInteger = 3
Const adBigInt = 20
Const adUnsignedTinyInt = 17
Const adUnsignedSmallInt = 18
Const adUnsignedInt = 19
Const adUnsignedBigInt = 21
Const adSingle = 4
Const adDouble = 5
Const adCurrency = 6
Const adDecimal = 14
Const adNumeric = 131
Const adBoolean = 11
Const adError = 10
Const adUserDefined = 132
Const adVariant = 12
Const adIDispatch = 9
Const adIUnknown = 13
Const adGUID = 72
Const adDate = 7
Const adDBDate = 133
Const adDBTime = 134
Const adDBTimeStamp = 135