最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
asp数据连接库代码
时间:2022-07-02 22:46:21 编辑:袖梨 来源:一聚教程网
这是我经常用的asp数据库连接代码,拿出来当然不是为了什么喽,只希望给初学者一些帮助,因为我记得我刚学时这个连接也搞一半天时间啊.
<%
Dim Rs,Conn//这里申明一下,必须在函数或过程外面申明,要不然会定义无效,原因是变量的全局和私有变量的原因了.
Sub Db_connect()//建立连接
Dpath ="datadb1.mdb"
Set Conn=Server.CreateObject("Adodb.connection")
Set Rs =Server.CreateObject("Adodb.Recordset")
Conn.connectionstring="Provider=Microsoft.Jet.oledb.4.0;Data source="&Server.MapPath(Dpath)
Conn.open
End sub
sub closedb()//关闭连接
if isobject(Rs) then
if not(Rs is nothing) then
Rs.close
set Rs=nothing
end if
end if
if isobject(Conn) then
if not(Conn is nothing) then
Conn.close
set Conn=nothing
end if
end if
end sub
'*********************************************************
function html_encode(html)//这里是进行基本的过滤函数,这个可以把textarea里面的回车替换成换行
dim temp
temp=replace(html,"<","<")
temp=replace(temp,">",">")
temp=replace(temp,"'","单引号")
temp=replace(temp,chr(13),"
")
html_encode=replace(temp,chr(32)," ")
end function
function encode_html(html)//这个刚好和上面个函数相反还原数据.
dim temp
temp=replace(html,"<","<")
temp=replace(temp,">",">")
temp=replace(temp,"单引号","'")
temp=replace(temp,chr(13),"
")
encode_html=replace(temp,chr(32)," ")
end function
%>
本站原创转载请注:www.111com.net
相关文章
- boss智能门锁如何设置密码 04-29
- 王者荣耀世界橘右京厉害吗 04-29
- 《青云劫攻略天赋技能,成就无敌仙侠》(解锁潜能,掌握绝学,成就仙侠传奇) 04-29
- 桃源深处有人家藏经室悟证一至七日通关答案 04-29
- 怎么击败《Saros》中的“破碎崛起”先知 Boss 04-29
- 宫小攻略技能推荐2023(玩转宫小,轻松游戏攻略指南) 04-29