以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- format问题 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=91005) |
-- 作者:刘林 -- 发布时间:2016/9/27 14:14:00 -- format问题 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类似的班号,请指点,谢谢。 |
-- 作者:有点蓝 -- 发布时间:2016/9/27 14:58:00 -- http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&Id=90996 请不要重复发贴
|