把IP表存入SQL里的程序

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

create.asp
-----------------------------------------------------------------------

 1   
 2'Option Explicit   
 3Server.Scripttimeout = 1000   
 4On Error Resume Next   
 5  
 6' Define your sql info here   
 7strSQLDSN = "xxxx"   
 8strSQLUsername = "sa"   
 9strSQLPassword = ""   
10  
11' This is where we connect to our sql server   
12Set adoConn = Server.CreateObject("ADODB.Connection")   
13ConnectionString = "dsn=" & strSQLDSN & ";uid=" & strSQLUsername & ";pwd=" & strSQLPassword & ""   
14adoConn.Open ConnectionString   
15'Set adoRS = Server.CreateObject("ADODB.Recordset")   
16  
17' get sql from ip.txt   
18Set fso = Server.Createobject("Scripting.FilesystemObject")   
19If fso.Fileexists(Server.Mappath("ip.txt")) then   
20Set a = fso.OpenTextFile(Server.Mappath("ip.txt"), 1, False)   
21Do While a.AtEndOfStream <> True   
22sql = a.readline   
23adoConn.Execute (sql)   
24Loop   
25a.close   
26set a = nothing   
27Else   
28Response.Write "文件没找到"   
29Response.End   
30End if   
31Set fso = Nothing   
32  
33'Error Handle   
34If err.number <> 0 then   
35  
36' this code come from http://bigeagle.wotoo.com   
37strMsg = strMsg + "********************************************" + vbcrlf   
38strMsg = strMsg + "错误时间:" + CStr(Now()) + vbcrlf   
39strMsg = strMsg + "错误类型:Err错误" + vbcrlf   
40strMsg = strMsg + "错误号 :" + CStr(Err.Number) + vbcrlf   
41strMsg = strMsg + "错误源 :" + Err.Source + vbcrlf   
42strMsg = strMsg + "错误描述:" + Err.Description + vbcrlf   
43strMsg = strMsg + "*********************************************" + vbcrlf   
44  
45strLogMsg = strLogMsg + "*****************************************" + vbcrlf   
46strLogMsg = strLogMsg + "错误时间:" + CStr(Now()) + vbcrlf   
47strLogMsg = strLogMsg + "错误类型:Err错误" + vbcrlf   
48strLogMsg = strLogMsg + "错误号 :" + CStr(Err.Number) + vbcrlf   
49strLogMsg = strLogMsg + "错误源 :" + Err.Source + vbcrlf   
50strLogMsg = strLogMsg + "错误描述:" + Err.Description + vbcrlf   
51strMsg = strMsg + "********************************************" + vbcrlf   
52  
53Response.Write strMsg   
54End If   
55  
Published At
Categories with Web编程
Tagged with
comments powered by Disqus