如何把IP表存到SQL数据库里去?

来源:asp之家 时间:2009-11-02 20:21:00 

有。试试下面这个程序:

saveip.asp

<%
Server.Scripttimeout = 1000
On Error Resume Next
strSQLDSN = "xxxx"
strSQLUsername = "sa"
strSQLPassword = ""
' 定义SQL信息
Set adoConn = Server.CreateObject("ADODB.Connection")
' 连接数据库
ConnectionString = "dsn=" & strSQLDSN & ";uid=" & strSQLUsername & ";pwd=" & strSQLPassword & ""
adoConn.Open ConnectionString
'Set adoRS = Server.CreateObject("ADODB.Recordset")
Set fso = Server.Createobject("Scripting.FilesystemObject")
    If fso.Fileexists(Server.Mappath("ip.txt")) then
' 从ip.txt得到SQL
      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
If err.number <> 0 then
 ' 错误控制
         
          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
          strLogMsg = strLogMsg + "错误号  :" + CStr(Err.Number) + vbcrlf
          strLogMsg = strLogMsg + "错误源  :" + Err.Source + vbcrlf
          strLogMsg = strLogMsg + "错误描述:" + Err.Description + vbcrlf
          strMsg = strMsg -------------------------------------------------------------------------vbcrlf
              
          Response.Write strMsg
End If 
%>

标签:IP,表,sql,数据库
0
投稿

猜你喜欢

  • Active Server Pages 错误 “ASP 0141”

    2009-08-19 17:10:00
  • 轻松解决AJAX的中文乱码问题

    2008-09-03 12:55:00
  • word-wrap同word-break的区别

    2007-10-24 20:08:00
  • asp中判断服务器是否安装了某种组件的函数

    2011-02-16 10:53:00
  • T-SQL 查询语句的执行顺序解析

    2011-11-03 17:04:06
  • asp如何使用ADO 2x Command 对象读取数据?

    2010-06-03 10:51:00
  • 怎样生成utf-8编码的html文件

    2009-03-11 19:34:00
  • 通过屏蔽IP来防止采集

    2007-08-19 15:28:00
  • 客户端模板的应用

    2007-05-11 16:50:00
  • 触手生春【4.13】CSS中的伪元素选择符

    2008-11-11 13:10:00
  • 如何判断字段的类型?

    2010-01-18 20:48:00
  • AXObject解决IE需要激活 ActiveX 控件方法

    2007-11-08 12:16:00
  • 3个JS控制图片滚动的效果

    2007-10-23 13:40:00
  • 基于网格的网页设计概念及实际应用案例

    2010-03-30 14:59:00
  • innerHTML 的一些问题

    2008-06-17 17:39:00
  • SQL Server讲堂:备份和恢复措施

    2009-05-22 10:21:00
  • text-indent 隐藏文字时出现的 outline问题

    2007-12-02 17:31:00
  • 通过模版字符串及JSON数据进行目标内容整理的一个小方法

    2010-01-12 16:55:00
  • 简单介绍各种浏览器中的本地存储方法

    2012-04-26 16:37:34
  • asp中的rs.open与conn.execute的区别说明

    2011-02-24 10:56:00
  • asp之家 网络编程 m.aspxhome.com