汗死。
DataTables("表A").ResumeRedraw
Dim wc As New System.Net.WebClient()
DataTables("表A").StopRedraw
Dim len As Integer = 100
Dim i As Integer = 1
Dim count As Integer = 1
Dim str As String = ""
Dim drs As List(Of DataRow) = DataTables("表A").Select("股piao代码 Is not null")
For Each dr As DataRow In drs
str &= dr("股piao代码") & ","
If i >= len * count OrElse i = drs.Count Then
Dim data As String = wc.DownloadString("http://hq.sinajs.cn/list=" & str.Trim(",")).Trim()
Dim idx As Integer = iif(i = drs.Count, drs.Count - len*(count-1), len)
For Each d As String In data.Split(";")
If idx >= 0 AndAlso d <> "" Then
Dim r As DataRow = drs(i - idx)
Dim start As Integer = d.IndexOf("""") + 1
Dim en As Integer = d.LastIndexOf("""")
Dim datas() As String = d.SubString(start, en - start).Split(",")
If datas.length >= 4 Then
r("股piao名字") = datas(0)
r("今日开盘") = datas(1)
r("昨日收盘") = datas(2)
r("当前价格") = datas(3)
End If
End If
idx -= 1
Next
count += 1
str = ""
End If
i += 1
Next
DataTables("表A").ResumeRedraw
[此贴子已经被作者于2014-12-31 10:46:33编辑过]