Foxtable(狐表)用户栏目专家坐堂 → 高手帮忙排下错,谢谢


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

主题:高手帮忙排下错,谢谢

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


加好友 发短信
等级:管理员 帖子:47497 积分:251403 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2012/5/4 13:02:00 [显示全部帖子]

Dim dlg As New OpenFileDialog '定义一个新的OpenFileDialog
dlg.InitialDirectory ="E:\A0File\"
dlg.Filter= "所有文件|*.*" '设置筛选器
If dlg.ShowDialog = DialogResult.Ok Then
    Dim S As String = FileSys.ReadAllText(dlg.FileName)
    Dim mmID As String =s.SubString(0,5)
    output.show (mmID)
    Dim mmDate As Date
    Dim dr As DataRow
    Dim mmYM As String =s.SubString(28,4) & "-" & s.SubString(33,2) & "-"
    Dim ss As String
    ss=s.Remove(0,s.LastIndexOf("T0")+3)
    ss=ss.Remove(ss.IndexOf("="))
    Dim s2() As String =ss.Split(chr(13))
    OutPut.show(s2.Length)
    For i As Integer =0 To s2.Length-1
        Dim s3() As String =s2(i).Split(" ")
        If s3(0) > "" AndAlso s3(1) > "" AndAlso s3(2) > "" Then
            mmDate =Cdate(mmYM & (i+1))
            Dim rr As String = "mID = '" & mmID & "' And mDate = " & "#" & mmDate & "#"
            dr = DataTables("WeatherData").Find(rr)
            If dr IsNot Nothing  Then
                Dim r As Integer
                r = Tables("WeatherData").FindRow(rr, 0, True )
                If r >= 0 Then '如果找到的话
                    Tables("WeatherData").Position = r '定位到找到的行.
                End If
                Tables("WeatherData").Current("mT02")=s3(0)
                Tables("WeatherData").Current("mT08")=s3(1)
                Tables("WeatherData").Current("mT14")=s3(2)
                Tables("WeatherData").Current("mT20")=s3(3)
                Tables("WeatherData").Current("mGt")=s3(4)
                Tables("WeatherData").Current("mDt")=s3(5)
            Else
                DataTables("WeatherData").AddNew()
                Tables("WeatherData").Position=Tables("WeatherData").Position+1
                Tables("WeatherData").Current("mID")=mmID
                Tables("WeatherData").Current("mDate")=mmDate
                Tables("WeatherData").Current("mT02")=s3(0)
                Tables("WeatherData").Current("mT08")=s3(1)
                Tables("WeatherData").Current("mT14")=s3(2)
                Tables("WeatherData").Current("mT20")=s3(3)
                Tables("WeatherData").Current("mGt")=s3(4)
                Tables("WeatherData").Current("mDt")=s3(5)
            End If
        End If
    Next
Else
    MessageBox.Show("你未选择任何文件" ,"提示") '提示用户选择的文件
End If

 回到顶部