Foxtable(狐表)用户栏目专家坐堂 → format问题


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

主题:format问题

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


加好友 发短信
等级:八尾狐 帖子:1953 积分:15015 威望:0 精华:0 注册:2016/4/28 9:58:00
format问题  发帖心情 Post By:2016/9/27 14:14:00 [显示全部帖子]

Dim Cols1() As String = {"学校名称","年级","班级","学生姓名","身份证件号"}
Dim Cols2() As String = {"单位名称","年级代码","班级","姓名","身份证件号"}
For Each dr1 As DataRow In DataTables("学生信息").DataRows
    Dim dr2 As DataRow = DataTables("成绩").AddNew()
    For i As Integer = 0 To Cols1.Length -1
        Select Case i
            Case 0
                dr2(Cols2(i)) = dr1(Cols1(i)).Substring(6,7)
            Case 1
                dr2(Cols2(i)) = dr1(Cols1(i)).Substring(4,2)           
            Case 2               
                Dim c() As Char = {"级", "班"}
                Dim str As String = dr1(Cols1(i))
                Dim s1() As String = str.Split(c)
                dr2(Cols2(i)) = format(s1(1),"00")
            Case 3,4
                dr2(Cols2(i)) = dr1(Cols1(i))    
        End Select
       
    Next
Next
 
 
请问老师,为什么红色代码填出来班级全为00呢?我是想填为01,02,11,12类似的班号,请指点,谢谢。

 回到顶部