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

ASP
将Recordset作为XML保存
在ASP中过滤用户输入 提高安全性
改进 ASP 应用程序中的字符串处理性能
在ASP中使用事务控制
在access中增加农历支持模块
用ADODB.Stream代替FSO读取文本文件
处理运行时间长的脚本以及内容大的主页
用ASP编程实现快速查找
Asp中代码与页面的分离
通过ASP自动解压RAR文件
如何正确处理数据库中的Null
采用XML数据来填充ASP表单
ASP整合的一个SQL语句类
在基于Mozilla的浏览器中使用XMLHttpRequest对象
巧用in关键字实现数据的批量删除
ASP中函数调用对参数的影响
加密处理使密码更安全[CFS编码加密]
ASP错误的几种常规处理方式
在ASP程序中执行SQL语句的安全性问题
ASP实用技巧28则

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 82 ::
收藏到网摘: 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