• 对过万条数据的数据库字段内容批量替换程序


    该程序是针对非常庞大的数据库开发的,没有用循环
    用途:
         对过万条数据的数据库字段内容批量替换
    代码: <% '//数据库连接     Dim BeeYee_DbName,Connstr,Conn,intSn1     Dim Content,Num,intSn,intIdNo,strCodea,strCodec,Rs,strSql
        Server.ScriptTimeOut = 800
        BeeYee_DbName="transfer"         '修改此处为你的SQL Server 数据库名称
        YourServer = "seven"       '修改此处为你的Sql Server数据库地址
        YourUid  = "sa"                   '修改此处为你的数据库用户名
        YourPassword = "123"           '修改此处为你的数据库密码    
        Connstr = "Driver={SQL Server};Server="&YourServer&";Uid="&YourUid&";Pwd="&YourPassword&";Database="&BeeYee_DbName
        Set Conn=Server.CreateObject("ADODB.CONNECTION")
        On Error Resume Next
        Conn.Open Connstr
        If Err<>0 Then
            err.Clear
            Set Conn = Nothing
            Response.Write "<div align=center><br><br><br>连接SqlServer数据库出错,请检查相关设置……</div>"
            Response.End   
        End If
    '//数据处理部分
        intSn = Request("Sn")
        intIdNo = Request("IdNo")
        If intSn = "" Or Not isNumeric(intSn) Then
            intSn = 0
            intSn1 = 0
        Else
            intSn = CLng(intSn)
            intSn1 = intSn
        End If
        If intIdNo = "" Or Not isNumeric(intIdNo) Then
            intIdNo = 0
        Else
            intIdNo = CLng(intIdNo)
        End If
        strCodea="/newe"                                    '//需要查询是否包含的字符串
        strCodeb="/news"                '//替换字符串
        strSql = "Select Top 1 Id,Content,Uptime From News where id>"&intIdNo&" And siteid=1 order by id"
        Set Rs = Server.CreateObject("adodb.recordset")
        Rs.Open strSql,conn,1,3
        If not(rs.eof oR rs.bof) then
            Content = Rs("content")
            Num = instr(content,strCodea)
            If Num>0 then           
                Content=Replace(content,strCodea,strCodeb)   
                Rs("Content") = Content
                Rs("Uptime") = now()
                Rs.Update
                intSn = intSn + 1
            End If
            intIdNo = Rs("Id")
            Rs.Close
            Set Rs = Nothing
            Response.Write("<br><br><br><Div align=center>正在转换第<font color=red>"&intSn&"</font>条新闻....</Div>")
            If intSn = intSn1 Then Response.Write("<br><br><br><Div align=center>新闻中没有要转换的东西,程序继续转换下一篇</Div>")
            Response.write("<meta http-equiv=""refresh"" content=""0;url=?Sn="&intSn&"&IdNo="&intIdNo&""">")
        Else
            Response.write("<br><br><br><Div align=center>转换完毕!!共转换<font color=red>"&intSn&"</font>条新闻.</Div>")
            Rs.Close
            Set Rs = Nothing
            Response.End()
        End If  
    %>
  • 相关阅读:
    使用idea2017搭建SSM框架(转发:https://www.cnblogs.com/hackyo/p/6646051.html#!comments)
    Maven下载、安装和配置(转发:http://blog.csdn.net/jiuqiyuliang/article/details/45390313)
    IDEA main方法自动补全(转发:http://blog.csdn.net/zjx86320/article/details/52684601)
    IntelliJ IDEA 设置代码提示或自动补全的快捷键 (附IntelliJ IDEA常用快捷键)(转发:https://www.cnblogs.com/jx17/p/6244491.html)
    使用IntelliJ IDEA 15和Maven创建Java Web项目
    easyui学习笔记
    Bootstrap学习笔记
    IoC和AOP
    面向对象的五大原则
    面向对象的思想
  • 原文地址:https://www.cnblogs.com/see7di/p/2240176.html
Copyright © 2020-2023  润新知