![]() ![]() Private Sub IP2Location(ByVal myip As String) Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles Me.Loadĭim ip As String = "2404:6800:4001:c01::67" Paste the following VB.NET code into the Form1.vb file and run the code: Imports In Visual Studio 2010 (or later), create a blank new windows form project which will create a Form1.vb file. ) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON Querying the IP2Location data from VB.NET winform Run the below SQL command to create a clustered index on the IP To field. Ip_to = (SUBSTRING(REPLICATE('0', 39), 1, 39 - LEN(ip_to)) ip_to) Create index to speed up queries Run the below SQL command to pad the 2 fields in the table. ) Padding the IP From and IP To fields to enable sorting as stringĭue to the fact that SQL Server 2008 R2 does not support a number with more than 38 digits, we have to store the IP From and IP To fields as zero-padded strings to enable sorting. Run the below SQL command to import the IP2Location data into the table. ) ON Importing the CSV data into MSSQLīefore import, you will need to create an FMT file to control how the import will load the data into the table.Ĭopy and paste the code below into a text file called DB26.FMT then save it to the same folder that you have saved the CSV file. Run the below SQL command to create a new table in the database for storing the IP2Location data. We will assume you have already setup MSSQL and you have. ![]() We will not cover the installation of MSSQL and. ![]() The aim of this guide is to demonstrate how to import IP2Location data (DB26) in CSV form into Microsoft SQL Server 2008 R2 and then query the data in VB.NET.įirst of all, you will need to download the IP2Location DB26 CSV file.Įxtract out the IPV6-COUNTRY-REGION-CITY-LATITUDE-LONGITUDE-ZIPCODE-TIMEZONE-ISP-DOMAIN-NETSPEED-AREACODE-WEATHER-MOBILE-ELEVATION-USAGETYPE-ADDRESSTYPE-CATEGORY-DISTRICT-ASN.CSV file from the downloaded zipped file and save it to C:\ folder. Importing IP2Location data into MSSQL (IPv6)
0 Comments
Leave a Reply. |