IP address global IP address query full version
Suddenly in a certain website to see IP address query, so whim made a. This is the use of ASP query the global IP address program, because the class-like use of ASP query IP speed is not very ideal, I am using the Macro blog macro IP address database, but it has been improved.
I passed the test on the win98+pws+access2000, the effect is more ideal.
Database design in the proportion of a software, no exaggeration to say accounted for 60%, although this is a small program, but also get a certain embodiment.
There are any mistakes or suggestions please be sure to send me e-mail:ljz811@163.com, I do not understand the "hunt" and other similar algorithms, Welcome to Exchange, thank you!
All right, cut the crap, let's go.
1, turn Wry.dll for. mdb because we want to optimize the database (for our use), we recommend doing this:
Change the file to Wry.xls and open it in Excel.
Create a new table IP in Access
Field Name Type length description
------------------------------------------------------------------------------------------------------------
ID Auto Number
NEWID number 5 StartIP first three digits
Seconded number 5 StartIP Part II three digits
StartIP text 20 Start IP segment
EndIP text 20 Stop IP segment
Country text the country or province where the IP is located
Local text IP location of this segment
Copy startip/endip/country/local four fields from Excel to access, the ID is automatically added, and for newid and secondid of course we can't add it by hand.
<!--#include file= "dbpath.asp"-->
<%
Sqlcmd= "SELECT * from IP"
' Recommended to use sqlcmd= ' select * from Ipwhere id>= value 1 and id< value 2 ' because it takes a lot to add a resource to about 10,000 data at a draught
Set Rs=ip.execute (sqlcmd)
Do as not rs.eof
Fir=left (RS ("StartIP"), 3)
Sec=mid (RS ("StartIP"), 5, 3)
sqlcmd3= "Update IP set newid= '" &str& "', secondid= '" SEC ""
Ip.execute sqlcmd3
Rs.movenext
&