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

ASP
利用ASP将HTML格式数据传输给Excel 的技巧
用ASP CSS实现随机背景
用ASP实现在线文章翻译的功能
动态网页爱好者来看:Asp过滤HTML的函数
自动去除字符中含有html代码的几个ASP函数
用ASP对网页进行简单的保护
ASP网页开发过程中的几个小技巧
ASP动态网页制作中使用SQL语句的方法
ASP开发中存储过程应用全接触
入门:初学ASP动态网页制作常用错误处理
ASP动态网页下UTF-8页面乱码的解决方法
小技巧:解决ASP脚本运行超时的方法
动态网页制作技术ASP开发中的常见问题
动态网页技术ASP日期和时间函数示例
ASP程序实现保存参数值的分页功能
用ASP寻找到真实IP地址的方法
ASP中文显示解决技巧及创建对象方法
ASP实例:Asp 防止网页频繁刷新一法
将ASP动态网页转换成HTM静态页面的方法
技巧:得到刚刚插入的记录的自动编号值一例

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


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