在线
客服

在线客服
尊敬的客户,我们24小时竭诚为您服务 公司总机: 0755-83312037 (32条线)

客服
热线

0755-83312037 (32条线)
7*24小时客服服务热线

?

关注
微信

关注官方微信
TOP

返回
顶部

ASP教程:删除记录和链接数据库程序解释

发布时间:2018-05-17浏览次数:762 <p> </p> <table style="BORDER-RIGHT: #cccccc 1px dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #cccccc 1px dotted; BORDER-LEFT: #cccccc 1px dotted; BORDER-BOTTOM: #cccccc 1px dotted" cellspacing="0" cellpadding="6" width="95%" align="center" border="0"><tbody><tr> <td style="WORD-WRAP: break-word" bgcolor="#fdfddf"> <font color="#ff0000">WebjxCom提示:</font><font color="#000000">ASP教程:删除程序和链接数据库程序解释.</font> </td> </tr></tbody></table> <h3> </h3> <p>一、删除记录 </p> <p>opendataconn '打开数据库连接 <br>xxlb=RtnReplaceInt(Trim(request("xxlb")),0) '从里到外依次是接收xxlb变量,去除变量两端的空格,最外层是一个自定义函数,估计与替换有关。 <br>id=changechr(request("id")) '接收id,并转换成字符串 <br>ids=split(id,",") '把id按 "," 分割,并保存到数组ids中 <br>for i=0 to ubound(ids) '用for循环遍历数组 <br>tt=trim(ids(i)) '数组元素去除两端空格后赋值给tt <br>conn.execute"delete from house where id="&amp;tt&amp;"" '删除数据表中id=tt变量的记录 <br>next '循环结束 <br>response.redirect "house.asp?xxlb="&amp;xxlb&amp;"" '跳转到house页面并用get方法传递xxlb参数,值为xxlb变量的值. <br>closedataconn 关闭数据库连接 </p> <h3> </h3> <p>二、连接数据库 </p> <p>dim conn '定义变量 <br>dim char_str(20) '定义数组 <br>sub OpenDataConn() '自定义过程,用户链接数据库地 <br>dim connstr 定义变量 <br>connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" <br>connstr = connstr &amp; Server.MapPath("../../data/fyhouse_free.mdb") '数据库驱动字符串 <br>'response.write connstr 输出变量connstr的值 <br>set conn=Server.CreateObject("AdoDb.Connection") '创建连接对象 <br>conn.Open connstr '链接数据库 <br>end sub 这句是过程的结束语,但从你贴出来的代码来看并没有开头。 </p> <!-- 导入 在此 参考资料--><!-- end 参考资料-->