以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 字符提取 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=84121) |
-- 作者:联友 -- 发布时间:2016/4/23 12:07:00 -- 字符提取 车次是:1号车(第1车)提取第一字符1、再提取提取第六字符1,地点编号开头是11再加01,地点编号是1101 车次是:1号车(第2车)提取第一字符1、再提取提取第六字符2,地点编号开头是12再加01,地点编号是1201 怎样把s2 加入,请指点,谢谢! Dim s2 As String = e.DataRow("车次").SubString(5,1) [此贴子已经被作者于2016/4/23 13:00:48编辑过]
|
-- 作者:联友 -- 发布时间:2016/4/23 13:46:00 -- Dim s1 As String = e.DataRow("车次").SubString(0,1) & e.DataRow("车次").SubString(5,1) Dim max As String max = e.DataTable.Compute("Max(地点编号)","学期 = \'2016年春季\' And 车次 = \'"& e.DataRow("车次") & "\'") \'取得该类别的最大编号 If max = "" Then e.DataRow("地点编号") = s1 & "01" Else Dim v As Integer = max.SubString(2,2) e.DataRow("地点编号") = s1 & format(v +1,"00") End If 搞定了 |