Foxtable(狐表)用户栏目专家坐堂 → [求助] 股价更新--请lin_hailun


  共有3912人关注过本帖树形打印复制链接

主题:[求助] 股价更新--请lin_hailun

帅哥哟,离线,有人找我吗?
有点甜
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/12/31 10:46:00 [显示全部帖子]

  汗死。

 


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编辑过]

 回到顶部