·建站首页 ·钻石 ·繁體
您的位置: 中国建站之家 -> 网站开发设计 -> ASP教程 -> 把IP表存入SQL里的程序

把IP表存入SQL里的程序

作者:未知  来源:转载  发布时间:2005-7-20 11:39:17  发布人:acx

写得比较粗糙,还有一点错误,不过能达到效果,凑合着用了,是4266条,不知道对也不对

create.asp
-----------------------------------------------------------------------
<%
'Option Explicit
Server.&#115cripttimeout = 1000
On Error Resume Next

' Define your sql info here
strSQLDSN = "xxxx"
strSQLUsername = "sa"
strSQLPassword = ""

' This is where we connect to our sql server
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("&#115cripting.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 http://bigeagle.wotoo.com
           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.De&#115cription + vbcrlf<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;strMsg = strMsg + "*********************************************" + vbcrlf<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;strLogMsg = strLogMsg + "*****************************************" + vbcrlf<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;strLogMsg = strLogMsg + "错误时间:" + CStr(Now()) + vbcrlf<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;strLogMsg = strLogMsg + "错误类型:Err错误" + vbcrlf<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;strLogMsg = strLogMsg + "错误号&nbsp;&nbsp;:" + CStr(Err.Number) + vbcrlf<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;strLogMsg = strLogMsg + "错误源&nbsp;&nbsp;:" + Err.Source + vbcrlf<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;strLogMsg = strLogMsg + "错误描述:" + Err.De&#115cription + vbcrlf<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;strMsg = strMsg + "********************************************" + vbcrlf<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Response.Write strMsg<br/>End If <br/><br/>%&gt; <br/><br/></div> <div></div> </div><div id="Message" class="Message"></div> <p><a href="javascript:window.open('http://shuqian.qq.com/post?from=3&title='+encodeURIComponent(document.title)+'&uri='+encodeURIComponent(document.location.href)+'&jumpback=2&noui=1','favit','width=930,height=470,left=50,top=50,toolbar=no,menubar=no,location=no,scrollbars=yes,status=yes,resizable=yes');void(0)" style="text-decoration:none;color:#155da5;display:block;background:url('http://shuqian.qq.com/img/add.gif') no-repeat 0px 0px;height:23px;width:300px;padding:2px 2px 0px 20px;font-size:14px;">将本文收藏到QQ书签与更多好友分享</a></p> <p><script language=javascript src=/wz/sg.JS></script></p> </div> </div> <div class="user_nav"><p>上一篇:<a href="/Article/10/130/2005/200507205788.html">用ASP实现论坛的UBB功能(二)</a></p> <p>下一篇:<a href="/Article/10/130/2005/200507205790.html">用ASP统计用户在站点的停留时间(1)</a> &nbsp;&nbsp;<script language=javascript src=/wz/wangzhai/wangzhai.js></script></p> </div> <div class="list_menu_b"> <div class="left"> <h2>热门阅读 &raquo;</h2> <ul> <li class="showlist1">· <a href="/Article/10/138/2005/200507256912.html" title="注册码大全二">注册码大全二</a></li> <li class="showlist2">· <a href="/Article/10/138/2005/200507256914.html" title="注册码大全四">注册码大全四</a></li> <li class="showlist1">· <a href="/Article/10/138/2005/200507256911.html" title="注册码大全一">注册码大全一</a></li> <li class="showlist2">· <a href="/Article/196/197/2005/2005081911736.html" title="要10G免费网络硬盘的请进来!">要10G免费网络硬盘的请进来!...</a></li> <li class="showlist1">· <a href="/Article/206/2007/2007030319347.html" title="通过google 赶快来赚美金">通过google 赶快来赚美金</a></li> <li class="showlist2">· <a href="/Article/10/138/2005/200507256919.html" title="注册码大全十">注册码大全十</a></li> <li class="showlist1">· <a href="/Article/10/138/2005/200507256913.html" title="注册码大全三">注册码大全三</a></li> <li class="showlist2">· <a href="/Article/14/253/2005/2005092114218.html" title="头像-qq头像(qq新头像)4">头像-qq头像(qq新头像)4</a></li> <li class="showlist1">· <a href="/Article/13/150/2006/2006022316028.html" title="让你轻松架设FTP服务器1">让你轻松架设FTP服务器1</a></li> <li class="showlist2">· <a href="/Article/14/244/2005/2005092014121.html" title="梦幻背景图片7">梦幻背景图片7</a></li> </ul> </div> <div class="right"> <h2>相关阅读 &raquo;</h2> <ul> <li class="showlist11">· <a href="/Article/10/130/2005/2005091613091.html" target="_blank" title="上传的进度条&nbsp;实时反映上传情况">上传的进度条 实时反映上...</a></li> <li class="showlist12">· <a href="/Article/10/131/2005/200507205186.html" target="_blank" title="全面剖析VB.NET(1)">全面剖析VB.NET(1)</a></li> <li class="showlist11">· <a href="/Article/11/143/2007/2007102522406.html" target="_blank" title="Photoshop巧妙制作水晶球里的风景特效">Photoshop巧妙制作水晶球...</a></li> <li class="showlist12">· <a href="/Article/10/137/2005/200507193941.html" target="_blank" title="Access数据库技术(58)">Access数据库技术(58)</a></li> <li class="showlist11">· <a href="/Article/11/140/2005/200507181499.html" target="_blank" title="Flash MX2004入门与进阶实例——声音和视频(14)">Flash MX2004入门与进阶...</a></li> <li class="showlist12">· <a href="/Article/11/143/2005/200507193498.html" target="_blank" title="Photoshop新手学堂:认识调整层(2)">Photoshop新手学堂:认识...</a></li> <li class="showlist11">· <a href="/Article/10/135/2005/200507181246.html" target="_blank" title="HTML组件之:HTML行为和HTC行为">HTML组件之:HTML行为和H...</a></li> <li class="showlist12">· <a href="/Article/10/130/2005/2005091713424.html" target="_blank" title="几个常用的小函数">几个常用的小函数</a></li> <li class="showlist11">· <a href="/Article/10/132/2007/2007102922441.html" target="_blank" title="TOMCAT的内存和连接数配置详解">TOMCAT的内存和连接数配...</a></li> <li class="showlist12">· <a href="/Article/10/130/2005/200507205827.html" target="_blank" title="ASP中FSO的神奇功能 - FSO不能做到的">ASP中FSO的神奇功能 - F...</a></li> </ul> </div> </div> </div> <div id="footer"> <div class="link"> <A href="http://www.jz123.cn/support/about.asp" target="_blank">关于我们</A> | <A href="http://www.jz123.cn/support/help.asp" target="_blank">网站帮助</A> | <A href="http://www.jz123.cn/support/advertise.asp" target="_blank">广告合作</A> | <A href="http://www.jz123.cn/" target="_blank">源码下载</A> | <A href="http://www.jz123.cn/support/sitemap.asp" target="_blank">网站地图</A> | <A href="http://www.jz123.cn/support/declare.asp" target="_blank">下载声明</A> | <font color=red>文章源码投搞:</font>jz123cn@126.com</A> </div> <div class="copyright"> Copyright &copy; 2002-2005 <b>jz123<font color=#ffffff>.cn</font></b></font></a>. All Rights Reserved . <center><script src='http://s6.cnzz.com/stat.php?id=44148&web_id=44148&show=pic' language='JavaScript' charset='gb2312'></script> </div> </div> </div> </body> </html> <span id="naruco_ad_body" style="display:none;"> <script language=javascript src=/adfile/top1.js></script> </span> <script type="text/javascript"> var naruco_ad = document.getElementById('naruco_ad'); if (naruco_ad != null) { naruco_ad.innerHTML=naruco_ad_body.innerHTML; naruco_ad_body.innerHTML=""; } </script>