zoukankan      html  css  js  c++  java
  • 我搞得大数据量处理程序(几千万数据同时处理不会超时)

    该程序是针对非常庞大的数据库开发的,没有用循环
    用途:
          对过万条数据的数据库字段内容批量替换
    代码:
    <%
    '//数据库连接
         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
        
    %>

  • 相关阅读:
    Vue|提示信息统一处理
    SpringBoot|封装接口实现自动创建job并且自动构建功能
    SpringBoot|自动创建job并且参数化构建
    SpringBoot|持久化常用注解
    SpringBoot|使用mybatis-generator-maven-plugin自动生成代码
    SpringBoot|config.properties通用Mapper配置
    SpringBoot|config.properties通用数据库连接配置
    SpringBoot|数据持久化技术现状
    Debian安装完成后没有无线网络的解决方法
    Debian系统设置terminal快捷键
  • 原文地址:https://www.cnblogs.com/see7di/p/2240123.html
Copyright © 2011-2022 走看看