我使用inet来进行网页的捕捉 我的程序结构是
conn.open .....
rs.open "...",conn,1,3
for i=1 to rs.recordcount
    使用inet download相对应的目标页面到临时文件
    然后使用程序剥离需要的数据
    保存入数据库
    关闭临时文件
    if not rs.eof and not rs.bof then
         rs.movenxt
    end if
next目前的问题是有时候程序的inet会出现timeout 但是我又不希望timeout实践设置过长
我希望能得到timeout反馈后 能重新尝试download页面 进行数据的判读。有什么方法
能实现。

解决方案 »

  1.   

    Private Sub Download(UrtFile As String, LocalFile As String)
    Dim bData() As Byte      '数据变量
    Dim intFile As Integer   '可用文件变量
        
        intFile = FreeFile()
        On Error Resume Next
        Kill LocalFile
        On Error GoTo 0
        
        bData() = Inet1.OpenURL(UrtFile, icByteArray)
        Open LocalFile For Binary Access Write As #intFile
            Put #intFile, , bData()
        Close #intFile
        Exit Sub
    Err1:
    MsgBox "error!"
    Resume
    End Sub或者在这段下载指定页面的代码里面如何使他一旦出现超时就不断重新尝试下载
    一直到成功下载到目标页面再返回调用他的sub里面