ASP函数库

减小字体 增大字体 作者:佚名  来源:本站整理  发布时间:2008-8-28 3:38:24 我要发布文章
HTML) OR strHTML="" Then Exit Function 
  Set objReg=New RegExp
  objReg.IgnoreCase =True
  objReg.Global=True
  objReg.Pattern="(&#)"
  strContent=objReg.Replace(strHTML,"")
  objReg.Pattern="(function|meta|value|window\.|script|js:|about:|file:|Document\.|vbs:|frame|cookie)"
  strContent=objReg.Replace(strContent,"")
  objReg.Pattern="(on(finish|mouse|Exit=|error|click|key|load|focus|Blur))"
  strContent=objReg.Replace(strContent,"")
  FilterJS=strContent
  strContent=""
  Set objReg=Nothing 
End Function
'**************************************************
'函数ID:0020[创建MsAccess数据库]
'函数名:CrDb_MsAccess
'作 用:创建MsAccess数据库
'参 数:DbPath     ---- 目标目录信息
'参 数:DbFileName ---- 目标库文件名称
'参 数:DbUpwd     ---- 目标库打开密码
'返回值:建立成功返回 True 否则 False
'**************************************************
Public Function CrDb_MsAccess(ByVal DbPath,ByVal DbFileName,ByVal DbUpwd)
  CrDb_MsAccess=False
  On Error GoTo 0
  On Error Resume Next
  DIM fxztxt,fu_fu_db_str,fu_db_str
  fxztxt=Chr(60)&"%Response.end()%"&Chr(62)
  If Right(DbPath,1)<>"\" Then DbPath=DbPath & "\"
  fu_fu_db_str="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&DbPath&"temp.mdb;"
  fu_db_str     ="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&DbPath&DbFileName&";Jet OLEDB:Database Password="&DbUpwd&";"
  Set fu_Ca = Server.CreateObject("ADOX.Catalog")
  fu_Ca.Create fu_fu_db_str
  Set fu_Ca = Nothing
  Set fu_Je = Server.CreateObject("JRO.JetEngine")
  fu_Je.CompactDatabase fu_fu_db_str,fu_db_str
  Set fu_fso = CreateObject("Scripting.FileSystemObject")
  fu_fso.DeleteFile(DbPath&"temp.mdb")
  Set fu_Je   = Nothing
  Set fu_fso  = Nothing
  set fu_Conn =server.createobject("ADODB.Connection")
  set fu_Rs   =server.createobject("ADODB.Recordset")
  fu_Conn.open fu_db_str
  fu_Sql_Str="CREATE TABLE [0] ([0] Text DEFAULT Notxt NOT NULL,[11] int IDENTITY (1, 1) NOT NULL PRIMARY KEY)"
  fu_Conn.Execute(fu_Sql_Str)
  fu_Sql_Str="Select * From [0]"
  fu_Rs.open fu_Sql_Str,fu_Conn,1,3
  fu_Rs.addnew
  fu_Rs("0")=fxztxt
  fu_Rs.update
  fu_Rs.Close
  fu_Conn.Close
  Set fu_Rs = Nothing
  Set fu_Conn = Nothing
  If Err.Number = 0 Then
     CrDb_MsAccess=True
  End If
  On Error GoTo 0
End function
'**************************************************
'函数ID:0021[创建MsSQLServer数据库]
'函数名:CrDb_MsSQLServer
'作 用:创建MsSQLServer数据库
'参 数:DbIp   ---- 数据库所在IP或主机名称
'参 数:DbSamc ---- 数据库超管用户名称
'参 数:DbSapwd---- 数据库超管用户口令
'参 数:DbName ---- 新建数据库名称
'参 数:DbUpmc ---- 新建数据库所属用户名称
'参 数:DbUpwd ---- 新建数据库所属用户密码
'返回值:建立成功返回 True 否则 False
'**************************************************
Public Function CrDb_MsSQLServer(ByVal DbIp,ByVal DbSamc,ByVal DbSapwd,ByVal DbName,ByVal DbUpmc,ByVal DbUpwd)
  CrDb_MsSQLServer=False
  On Error GoTo 0
  On Error Resume Next
  DIM fu_Sa_Str,fu_Ua_Str,fu_Conn,fu_Rs,fu_Sql_Str,fxztxt
  fxztxt=Chr(60)&"%Response.end()%"&Chr(62)
  fu_Sa_Str  ="DRIVER=SQL Server;UID="&DbSamc&";DATABASE=master;SERVER="&DbIp&";PWD="&DbSapwd&";"
  fu_Ua_Str  ="DRIVER=SQL Server;UID="&DbUpmc&";DATABASE="&DbName&";SERVER="&DbIp&";PWD="&DbUpwd&";"
  Set fu_Conn = Server.CreateObject("ADODB.Connection")
  fu_Conn.Open fu_Sa_Str
  fu_Conn.Execute "CREATE DATABASE " &DbName
  fu_Conn.Close
  fu_DB_Conn_Str="DRIVER=SQL Server;UID="&DbSamc&";DATABASE="&DbName&";SERVER="&DbIp&";PWD="&DbSapwd&";"
  fu_Conn.Open fu_DB_Conn_Str
  fu_Sql_Str="EXEC sp_addlogin '"&DbUpmc&"','"&DbUpwd&"','"&DbName&"'"
  fu_Conn.Execute fu_Sql_Str
  fu_Sql_Str="EXEC sp_grantdbaccess '"&DbUpmc&"'"
  fu_Conn.Execute fu_Sql_Str
  fu_Sql_Str="EXEC sp_addrolemember 'db_owner', '"&DbUpmc&"'"
  fu_Conn.Execute fu_Sql_Str
  fu_Sql_Str="EXEC sp_defaultdb "&DbUpmc&","&DbName
  fu_Conn.Execute fu_Sql_Str
  fu_Conn.Close
  fu_Conn.open fu_Ua_Str
  fu_Sql_Str="CREATE TABLE [0] ([0] Text DEFAULT ('Notxt') NOT NULL,[11] int IDENTITY (1, 1) NOT NULL PRIMARY KEY)"
  fu_Conn.Execute fu_Sql_Str
  Set fu_Rs=server.createobject("ADODB.Recordset")
  fu_Sql_Str="Select * From [0]"
  fu_Rs.open fu_Sql_Str,fu_Conn,1,3
  fu_Rs.addnew
  fu_Rs("0")=fxztxt
  fu_Rs.update
  fu_Rs.Close
  fu_Conn.Close
  Set fu_Rs = Nothing
  Set fu_Conn=Nothing
  If Err.Number = 0 Then
     CrDb_MsSQLServer=True
  End If
  On Error GoTo 0
End function
'**************************************************
'函数ID:0022[通过JMAIL发信]
'函数名:MSMail
'作 用:通过JMAIL发信
'参 数:subject      ---- 邮件的标题
'参 数:mailaddress  ---- 邮件服务器地址
'参 数:senderName   ---- 发件人名称
'参 数:email        ---- 收件人E-MAIL地址
'参 数:content      ---- 邮件内容
'参 数:fromer       ---- 发件人E-MAIL地址
'参 数:serEmailUser ---- 邮件服务器权限用户名
'参 数:serEmailPass ---- 邮件服务器权限用户密码
'返回值:发送成功返回 True 否则 False
'示 例:MSMail("test","smtp.163.com","mzy","mzymcm@yahoo.com.cn","test","mzymcm@163.com","mzymcm","abcmzy1029abc")
'**************************************************
Public Function MSMail(ByVal subject, ByVal mailaddress, ByVal senderName, ByVal email, ByVal content, ByVal fromer, ByVal serEmailUser, ByVal serEmailPass)
  dim JmailMsg
  MSMail=False
  set JmailMsg=server.createobject("jmail.message")
  JmailMsg.mailserverusername=serEmailU

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17]  下一页