以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 截取数字减去10,之后加上汉字,拷贝到另外一表 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=102676) |
||||
-- 作者:bootes29 -- 发布时间:2017/6/23 16:38:00 -- 截取数字减去10,之后加上汉字,拷贝到另外一表 各位老师好,我学习了三个表关联的数据流转, For Each dcb As DataCol In dtb.DataCols fdrd(dcb.name) = drb(dcb.name) Next 比如这个全部相同名字的都转过来。 实际工作中,我想把价格这项中的数字,都减去10,之后拷贝到表c 仍然保留着汉字,这该如何实现?
|
||||
-- 作者:bootes29 -- 发布时间:2017/6/23 16:38:00 -- 这是table
|
||||
-- 作者:有点蓝 -- 发布时间:2017/6/23 17:11:00 -- Dim ns As new List(of String) ns.AddRange(new String() {"成人","儿童","单房差"}) Dim str As String = "成人2870,儿童2270,单房差770" Dim arr() As String = str.Split(",") Dim n As String Dim p As Double str = "" For Each Ar As String In arr For Each n1 As String In ns If ar.Contains(n1) Then n = n1 Exit For End If Next p = val(ar.Replace(n,"")) - 10 str &= n & p & "," Next Output.Show(str) 具体什么应用到项目里留做作业
|
||||
-- 作者:bootes29 -- 发布时间:2017/6/23 18:26:00 -- 感谢老师指导,还留了作业 |
||||
-- 作者:bootes29 -- 发布时间:2017/6/23 18:58:00 -- Dim dtb As DataTable = DataTables("表b") Dim dtc As DataTable = DataTables("表c") Dim ns As new List(of String) ns.AddRange(new String() {"成人","儿童","单房差"}) Dim str As String = dt.DataCols("价格") Dim arr() As String = str.Split(",") Dim n As String Dim p As Double str = "" For Each Ar As String In arr For Each n1 As String In ns If ar.Contains(n1) Then n = n1 Exit For End If Next p = val(ar.Replace(n,"")) - 10 str &= n & p & "," Next Dim ndr As DataRow = dtc.AddNew ndr("价格")=str |
||||
-- 作者:有点蓝 -- 发布时间:2017/6/23 20:57:00 -- Dim dtb As DataTable = DataTables("表b") Dim dtc As DataTable = DataTables("表c") Dim ns As new List(of String) ns.AddRange(new String() {"成人","儿童","单房差"}) For Each dr As DataRow In dtb.DataRows Dim str As String = dr("价格") Dim arr() As String = str.Split(",") Dim n As String Dim p As Double str = "" For Each Ar As String In arr For Each n1 As String In ns If ar.Contains(n1) Then n = n1 Exit For End If Next p = val(ar.Replace(n,"")) - 10 str &= n & p & "," Next Dim ndr As DataRow = dtc.AddNew ndr("价格")=str Next
|
||||
-- 作者:bootes29 -- 发布时间:2017/6/24 20:43:00 -- 感谢 有点蓝 老师周末 还来指导,昨天应酬没上电脑。 这两天,又把编程指南 仔细的 看了下,一边做一边反过来再看,感觉果然不一样。 |
||||
-- 作者:bootes29 -- 发布时间:2017/6/27 9:46:00 -- 值不能为空。 参数名: oldValue --------------------- 老师好,为什么,有时候会有这个报错?
|
||||
-- 作者:bootes29 -- 发布时间:2017/6/27 9:50:00 -- 这个对照表,我想默认 设置为 别人编号 我们编号 都有 这该如何表达?
|
||||
-- 作者:bootes29 -- 发布时间:2017/6/27 10:01:00 -- e.Form.Controls("TreeView1").BuildTree("表c", "别人编号|我们编号") Dim nd = e.Form.Controls("TreeView1").nodes.insert("所有", 0) nd.checked = True Tables("表c").Filter = "" 这个默认所有的时候,只有所有这个框里有√,其他的并没有
|