以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- for语句怎么改成case语句啊?麻烦指点一下奥~ (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=76195) |
-- 作者:jinzhengbe -- 发布时间:2015/10/23 12:46:00 -- for语句怎么改成case语句啊?麻烦指点一下奥~ For Each dr1 As DataRow In DataTables("商品").Select("[length] =\'al\' or [length] =\'apm\' ") \'20 Dim dr5 As DataRow = DataTables("miya").AddNew() Dim dr6 As DataRow = DataTables("tianma2").AddNew() Dim dr7 As DataRow = DataTables("newtrj").AddNew() Dim dr8 As DataRow = DataTables("bong").AddNew() For i As Integer = 0 To Cols1.Length -1 dr5(Cols5(i)) = dr1(Cols1(i)) dr6(Cols6(i)) = dr1(Cols1(i)) dr7(Cols7(i)) = dr1(Cols1(i)) dr8(Cols8(i)) = dr1(Cols1(i)) Next Next
For Each dr1 As DataRow In DataTables("商品").Select("[length] =\'de\' or [length] =\'nuzz\' or [length] =\'a6\' or [length] =\'1ph\'") \'30 Dim dr9 As DataRow = DataTables("miyadn").AddNew() Dim dr10 As DataRow = DataTables("tianma2dn").AddNew() Dim dr4 As DataRow = DataTables("newtrjdn").AddNew() Dim dr5 As DataRow = DataTables("bongdn").AddNew() Dim dr6 As DataRow = DataTables("ivandn").AddNew() Dim dr7 As DataRow = DataTables("xinliangdn").AddNew() Dim dr10 As DataRow = DataTables("yunfengdn").AddNew() Dim dr12 As DataRow = DataTables("dalongdn").AddNew() For i As Integer = 0 To Cols1.Length -1 dr2(Cols2(i)) = dr1(Cols1(i)) dr3(Cols3(i)) = dr1(Cols1(i)) dr4(Cols4(i)) = dr1(Cols1(i)) dr5(Cols5(i)) = dr1(Cols1(i)) dr6(Cols6(i)) = dr1(Cols1(i)) dr7(Cols7(i)) = dr1(Cols1(i))
dr10(Cols10(i)) = dr1(Cols1(i)) dr12(Cols12(i)) = dr1(Cols1(i)) Next Next
For Each dr1 As DataRow In DataTables("商品").Select("[length] <>\'uus\' or [length] \'qn\' ") 40 Dim dr2 As DataRow = DataTables("miyauus").AddNew() Dim dr3 As DataRow = DataTables("tianma2uus").AddNew() Dim dr4 As DataRow = DataTables("newtrjuus").AddNew() Dim dr5 As DataRow = DataTables("bonguus").AddNew() Dim dr6 As DataRow = DataTables("ivanuus").AddNew() Dim dr7 As DataRow = DataTables("xinlianguus").AddNew() Dim dr10 As DataRow = DataTables("yunfenguus").AddNew() Dim dr12 As DataRow = DataTables("dalonguus").AddNew() For i As Integer = 0 To Cols1.Length -1 dr2(Cols2(i)) = dr1(Cols1(i)) dr3(Cols3(i)) = dr1(Cols1(i)) dr4(Cols4(i)) = dr1(Cols1(i)) dr5(Cols5(i)) = dr1(Cols1(i)) dr6(Cols6(i)) = dr1(Cols1(i)) dr7(Cols7(i)) = dr1(Cols1(i))
dr10(Cols10(i)) = dr1(Cols1(i)) dr12(Cols12(i)) = dr1(Cols1(i)) Next Next
上面是我做的代码,只是其中的一部分, 如果要按照上面的形式一直写下去的话,实在是太多了所以想想是不是能换成case语句 意图是 主要根据 lei的列 来选择要将数据插入到哪个表中
请各位大侠指点啊,实在是不会!!非常感谢!!! |
-- 作者:大红袍 -- 发布时间:2015/10/23 14:52:00 -- 不能改,你每种的筛选,要做的功能都不一样,只能这样写。 |