Foxtable(狐表)用户栏目专家坐堂 → 填充数据的时候可否不按照顺序填充?


  共有3054人关注过本帖树形打印复制链接

主题:填充数据的时候可否不按照顺序填充?

帅哥哟,离线,有人找我吗?
jinzhengbe
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:五尾狐 帖子:1062 积分:9781 威望:0 精华:0 注册:2012/3/13 5:23:00
填充数据的时候可否不按照顺序填充?  发帖心情 Post By: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")


 


 回到顶部