2013-08-05 24 views
0

我已導入的MaxMind DLL和下載GeoIp.dat數據庫來獲取我用下面的代碼的MaxMind GeoIP的數據庫無法打開

 Dim ls As New LookupService("GeoIP.dat", LookupService.GEOIP_MEMORY_CACHE) 
     'get country of the ip address 

     Dim c As Country = ls.getCountry("24.24.24.24") 
     Console.Write(" code: " & c.getCode() & vbLf) 
     Console.Write(" name: " & c.getName() & vbLf) 
     CountryName.Text = " name: " & c.getName() & vbLf 

Dim c As Country = ls.getCountry("24.24.24.24") 

給出了一個IP地址的國名我出現以下錯誤 數據庫已關閉。 可能是什麼問題

回答

0

我should'v寫這樣

Dim ls As New LookupService(MapPath ("GeoIP.dat"), LookupService.GEOIP_MEMORY_CACHE) 
    Dim c As Country = ls.getCountry("24.24.24.24") 
    Console.Write(" code: " & c.getCode() & vbLf) 
    Console.Write(" name: " & c.getName() & vbLf) 
    CountryName.Text = " name: " & c.getName() & vbLf