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类似的班号,请指点,谢谢。
|