以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 表实现自动增长 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=158254) |
||||
-- 作者:hopestarxia -- 发布时间:2020/11/12 22:08:00 -- 表实现自动增长 老师,我想实现将窗口Table1表中的行数据拆行成具体明细增加到表number中,请都是帮检查一下指导代码: For Each rs As Row In e.form.Controls("Table1").Table.rows Dim ccmd As New SQLCommand ccmd.C Dim str5,str6 As String 代码一起发发表时报错,把代码放到附件文本里了。
|
||||
-- 作者:有点蓝 -- 发布时间:2020/11/12 22:21:00 -- For Each rs As Row In e.form.Controls("Table1").Table.rows Dim ccmd As New SQLCommand ccmd.C Dim str5,str6 As Integer ccmd.commandtext = "select cd From dhkzl where code = \'" & rs("hdcode") & "\' " 此代码是得出对应行数据计算增长量从第几位开始, str5 = ccmd.ExecuteScalar() 假设得到数据12 ccmd.commandtext = "select cdzj From dhkzl where code = \'" & rs("hdcode") & "\' " 此代码是得出计算增量数据共有几位, str6 = ccmd.ExecuteScalar() 假设得到数据5 Dim sds As Integer = rs("qsbh").substring(str5,str6) 此代码是起始号码,例如为 920MA5012P010051E1,则正确结果SDS = 10051,但我写 代码 Dim sds As Double =substring(rs("qsbh") ,str5,str6) 代码报错. Dim eds As Integer =rs("jsbh").substring(str5,str6) 此代码是结束号码,例如为 920MA5012P010070E1,则正确结果EDS = 10070,但我写 代码 Dim Eds As Double =substring(rs("jsbh") ,str5,str6) 代码报错. For ii As Integer = sds To eds Dim nrs As DataRow =DataTables("number").AddNew() (10051 与 10070之间相差20个数,这里循环增加) nrs("num") = rs("qsbh").substring(0,str5) & format(ii, "00000") & "E1" \'余下位数, (这里代码应该如何写,组合起来为 920MA5012P010051E1) nrs.Save() Next Next
|