从网页获取股piao代码的行业和概念数据,读取50行数据以内就出现“超出系统资源”的提示,并退出程序,问题出在哪里,如何解决,请各位老师指教,谢谢!
此主题相关图片如下:捕获c.png
If Forms("窗口1").Opened Then
Dim dm1 As String
Dim ms As Integer = Forms("窗口1").Controls("TextBox2").Text '码数
Dim i As Integer
For i = 1 To ms
dm1 = Tables("代码").Current("代码")
Dim web As New System.Windows.Forms.WebBrowser()
web.ScriptErrorsSuppressed = True
Dim dr As DataRow = DataTables("代码").Find("代码 = '" & dm1 & "'")
If dr IsNot Nothing Then
If dr.IsNull("代码") = False And dr.IsNull("行业") Then
web.Navigate("https://vip.stock.finance.sina.com.cn/corp/go.php/vCI_CorpOtherInfo/stockid/" & dr("代码") & "/menu_num/2.phtml") '新浪网
Do Until web.ReadyState = 4
Application.DoEvents
Loop
Dim hy As String = ""
Dim tb1 As object = web.Document.GetElementsByTagName("table")(3)
Dim trs1 = tb1.GetElementsByTagName("tr")
Dim tds1 As object = trs1(2).GetElementsByTagName("td")
hy = tds1(0).innerText
If hy = "" Then
hy = "无"
End If
Dim gn As String = ""
Dim tb2 As object = web.Document.GetElementsByTagName("table")(4)
Dim trs2 = tb2.GetElementsByTagName("tr")
For i2 As Integer = 1 To trs2.count-1
Dim tds2 As object = trs2(i2).GetElementsByTagName("td")
If tds2.count > 0
If gn = "" Then
gn = tds2(0).innerText
Else
gn = gn & "," & tds2(0).innerText
End If
End If
Next
If gn = "对不起,暂时没有相关概念板块信息" Then
gn = "无"
End If
dr("行业") = hy
dr("概念") = gn
GC.Collect()
End If
End If
DataTables("代码").Save()
Forms("窗口1").Controls("TextBox3").Text = dm1
With Tables("代码")
.Position = .Position + 1
End With
Next
Forms("窗口1").Controls("TextBox1").Text = Forms("窗口1").Controls("TextBox3").Text
End If
[此贴子已经被作者于2021/1/10 17:29:03编辑过]