以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 填充数据的时候可否不按照顺序填充? (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=55474) |
-- 作者:jinzhengbe -- 发布时间:2014/8/17 18:49:00 -- 填充数据的时候可否不按照顺序填充? 填充数据的时候可否不按照顺序填充? 填充数据的时候可否不按照顺序填充? 下面的代码中。dr1 的数据 添加到 dr2 ,dr3,dr4....等等时,顺序都是一样的(都是按照dr1原来数据的排序方式导入的。 有没有办法可以让导入后的 数据都不相同,或者按照随机方式排序, 假如要dr1 的数据 1, 2, 3, 4, 5 导入到dr2 后顺序变成 2,3, 5, 4 ,1 导入到dr2 后顺序变成 5,4, 3 ,2, 1 导入到dr3 后顺序变成 1, 3, 5 ,2 ,4 可以实现么?如果可以麻烦详细的给指点一下奥~~~ Dim Cols1() As
String =
{"costPrice","color","weight","length","eng_name","pic","cn_name","width","gongxiang","isCheck","mu","lei","addtime","ccc","lei"} Dim Cols2() As
String =
{"costPrice","color","weight","length","eng_name","pic","cn_name","width","gongxiang","isCheck","mu","lei","addtime","ccc","lei"} Dim Cols3() As
String =
{"costPrice","color","weight","length","eng_name","pic","cn_name","width","gongxiang","isCheck","mu","lei","addtime","ccc","lei"} Dim Cols4() As
String = {"costPrice","color","weight","length","eng_name","pic","cn_name","width","gongxiang","isCheck","mu","lei","addtime","ccc","lei"} Dim Cols5() As
String =
{"costPrice","color","weight","length","eng_name","pic","cn_name","width","gongxiang","isCheck","mu","lei","addtime","ccc","lei"}
For Each dr1 As
DataRow In DataTables("jinzhengbe").Select("[id] is not
Null") Dim dr2 As
DataRow = DataTables("cai").AddNew() Dim dr3 As
DataRow = DataTables("tianma").AddNew() Dim dr4 As DataRow = DataTables("new").AddNew() Dim dr5 As DataRow
= DataTables("hongfu").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)) Next Next DataTables("jinzhengbe").Save() DataTables("cai").Save() Dim po As
String=user.name Dim Book As New
XLS.Book(ProjectPath & "Attachments\\导入格式.xls") Book.Build() Book.Save("d:\\cai\\"
& Date.Today & "导入格式.xls")
|
-- 作者:有点甜 -- 发布时间:2014/8/17 19:04:00 -- 不明白你的意图是什么,如果要改顺序,那么你就把Cols1、Cols2对应的顺序换一下就好了。 |
-- 作者:czy -- 发布时间:2014/8/17 19:57:00 -- Select加个排序试试
Dim Names() As String = {"排序列1", "排序列2","排序列3","排序列4","排序列5"}
|