当前位置: 首页 > 图文教程 > 网络编程 > ASP > 使用ADO批量更新记录(源代码)

ASP
使用组件搜索
检查sql字符串中是否有单引号,有则进行转化.
判断文章中文字符数量
转换html代码子程序
简单的检查输入email是否合法程序
检查来访IP是否合法的实际应用
如何使用asp创建dsn
如何用asp进行base64加密
在ASP+中使用Cookie
asp+ 如何跨站抓取页面
在Asp中不借助第三方组件抓取别的站点的页面
如何在网页中变化图象(速度无延迟)
利用OWC服务器端组件动态生成图表
实现聊天室在线人员无刷新所需要的javascript技术 - 1
实现聊天室在线人员无刷新所需要的javascript技术 - 2
实现聊天室在线人员无刷新所需要的javascript技术 - 3
精彩ASP-镜象站点速度测试
在JSP、ASP和PHP网站网页中使用XHTML
ADO如何善用RecordSet组件呢?
ADO如何新增修改刪除数据库的资料呢?

ASP 中的 使用ADO批量更新记录(源代码)


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 57 ::
收藏到网摘: n/a

  '**************************************
    ' Name: Batch Update using ADO
    ' Description:ADO has a great batch upda
    '     te feature that not many people take adv
    '     antage of. You can use it to update many
    '     records at once without making multiple
    '     round trips to the database. Here is how
    '     to use it.
    ' By: Found on the World Wide Web
    '
    '
    ' Inputs:None
    '
    ' Returns:None
    '
    'Assumes:None
    '
    'Side Effects:None
    '
    'Warranty:
    'code provided by Planet Source Code(tm)
    '     (http://www.Planet-Source-Code.com) 'as
    '     is', without warranties as to performanc
    '     e, fitness, merchantability,and any othe
    '     r warranty (whether expressed or implied
    '     ).
    '**************************************
    
    <HTML>
    <HEAD><TITLE>Place Document Title Here</TITLE></HEAD>
    <BODY BGColor=ffffff Text=000000>
    <%
    Set cn = Server.CreateObject("ADODB.Connection")
    Set rs = Server.CreateObject("ADODB.RecordSet")
    cn.Open Application("guestDSN")
    rs.ActiveConnection = cn
    rs.CursorType = adOpenStatic
    rs.LockType = adLockBatchOptimistic
    rs.Source = "SELECT * FROM authors"
    rs.Open
    If (rs("au_fname") = "Paul") or (rs("au_fname") = "Johnson") Then
    newval = "Melissa"
    Else
    newval = "Paul"
    End If
    If err <> 0 Then
    %>
    <B>Error opening RecordSet</B>
    <% Else %>
    <B>Opened Successfully</B><P>
    <% End If %>
    <H2>Before Batch Update</H2>
    <TABLE BORDER=1>
    <TR>
    <% For i = 0 To rs.Fields.Count - 1 %>
    <TD><B><%= rs(i).Name %></B></TD>
    <% Next %>
    </TR>
    <% For j = 1 To 5 %>
    <TR>
    <% For i = 0 To rs.Fields.Count - 1 %>
    <TD><%= rs(i) %></TD>
    <% Next %>
    </TR>
    <%
    rs.MoveNext
    Next
    rs.MoveFirst
    %>
    </TABLE>
    Move randomly In the table and perform upd