以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]重新编号问题 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=85111) |
||||
-- 作者:方丈 -- 发布时间:2016/5/18 9:55:00 -- [求助]重新编号问题 请教代码: 表“图书原始数据”中有“图书序号”列和“总册数”列,怎样一键填充表“图书重编号数据”,要求新生成的表中“重新编号”=“图书序号”+ 三位流水号,每一种图书填充总行数为“总册数”的数量,流水号从001到总册数;
谢谢!
|
||||
-- 作者:大红袍 -- 发布时间:2016/5/18 10:35:00 -- Dim dt1 As DataTable = DataTables("图书原始数据") Dim dt2 As DataTable = DataTables("图书重编号数据") dt2.DataRows.Clear Dim cs1() As String = {"图书序号","总册数","书名","单价","作者","版别"} Dim cs2() As String = {"图书序号","总册数","书名","单价","作者","版别"} For Each dr1 As DataRow In dt1.Select("") For j As Integer = 1 To dr1("总册数") Dim dr2 = dt2.AddNew dr2("重新编号") = dr1("图书序号") & "-" & format(j, "000") For i As Integer = 0 To cs1.length-1 dr2(cs2(i)) = dr1(cs1(i)) Next Next Next |
||||
-- 作者:方丈 -- 发布时间:2016/5/18 11:26:00 -- 以下是引用大红袍在2016/5/18 10:35:00的发言:
Dim dt1 As DataTable = DataTables("图书原始数据") Dim dt2 As DataTable = DataTables("图书重编号数据") dt2.DataRows.Clear Dim cs1() As String = {"图书序号","总册数","书名","单价","作者","版别"} Dim cs2() As String = {"图书序号","总册数","书名","单价","作者","版别"} For Each dr1 As DataRow In dt1.Select("") For j As Integer = 1 To dr1("总册数") Dim dr2 = dt2.AddNew dr2("重新编号") = dr1("图书序号") & "-" & format(j, "000") For i As Integer = 0 To cs1.length-1 dr2(cs2(i)) = dr1(cs1(i)) Next Next Next 谢谢,
当“借书登记表”中某一“图书序号”增加借书记录时,在“借书重编号记录”表中相应图书后面的“借书记录”列填入“1”,同一种序号图书第1人借出记录在001后面,第2人借出记录在002后面......怎么办?
|
||||
-- 作者:大红袍 -- 发布时间:2016/5/18 11:37:00 -- datacolchanged事件
If e.DataCol.name = "图书序号" Then
|