查询一个80万的IP地址数据库,VB程序会在查询的时候停顿,必须在查询完成后才能进行其它操作,请教高手如何处理?
查询一个80万的IP地址数据库,VB程序会在查询的时候停顿,必须在查询完成后才能进行其它操作,请教高手如何处理?
Function fwip(ipp)Call LinkDBDim iCount As Long Dim strUsers As String Dim adoRs As New ADODB.Recordset Dim strTemp As String 'ipp = "25.65.45.78"If ipp <> "unknown" And ipp <> "" And InStr(ipp, ".") > 1 Thensip = Split(ipp, ".")ssip = sip(0) * 256 * 256 * 256 + sip(1) * 256 * 256 + sip(2) * 256 + sip(3)SQL = ("select top 1 ip2,country,city from address where ip2 > " & ssip & " order by ip2 asc ")adoRs.open SQL, Conns, 1, 1If Not adoRs.EOF ThenAdd = adoRs("country") & adoRs("city")ElseAdd = "未知地址"End IfadoRs.CloseEnd IfConns.CloseSet adoRs = NothingSet Conns = NothingEnd FunctionPrivate Function LinkDB() '连接数据库代码 On Error GoTo LinkDB_Err Dim strConn As String strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=" & App.Path & "\msnabaga.mdb" '设置连接字串,连接数据库 Conns.open strConn Exit FunctionLinkDB_Err: MsgBox Err.Number & vbCrLf & Err.Description, , GstrAppTitleEnd Function