欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

把IP表存入SQL里的程序

程序员文章站 2022-05-17 16:06:00
写得比较粗糙,还有一点错误,不过能达到效果,凑合着用了,是4266条,不知道对也不对create.-----------------------------------------...
写得比较粗糙,还有一点错误,不过能达到效果,凑合着用了,是4266条,不知道对也不对

create.
-----------------------------------------------------------------------
<%
option explicit
server.scripttimeout = 1000
on error resume next

define your sql info here
strsqldsn = "xxxx"
strsqlusername = "sa"
strsqlpassword = ""

this is where we connect to our sql server(windows平台上强大的平台)
set adoconn = server.createobject("adodb.connection")
connectionstring = "dsn=" & strsqldsn & ";uid=" & strsqlusername & ";pwd=" & strsqlpassword & ""
adoconn.open connectionstring
set adors = server.createobject("adodb.recordset")

get sql from ip.txt
set fso = server.createobject("scripting.filesystemobject")
    if fso.fileexists(server.mappath("ip.txt")) then
       set a = fso.opentextfile(server.mappath("ip.txt"), 1, false)
           do while a.atendofstream <> true
              sql = a.readline
              adoconn.execute (sql)
           loop
       a.close
       set a = nothing
    else
    response.write "文件没找到"
    response.end
    end if
set fso = nothing

error handle
if err.number <> 0 then
           
            this code come from
           strmsg = strmsg + "********************************************" + vbcrlf
           strmsg = strmsg + "错误时间:" + cstr(now()) + vbcrlf
           strmsg = strmsg + "错误类型:err错误"        + vbcrlf
           strmsg = strmsg + "错误号  :" + cstr(err.number) + vbcrlf
           strmsg = strmsg + "错误源  :" + err.source   + vbcrlf
           strmsg = strmsg + "错误描述:" + err.description + vbcrlf
           strmsg = strmsg + "*********************************************" + vbcrlf

           strlogmsg = strlogmsg + "*****************************************" + vbcrlf
           strlogmsg = strlogmsg + "错误时间:" + cstr(now()) + vbcrlf
           strlogmsg = strlogmsg + "错误类型:err错误" + vbcrlf