原 附件在 http://www.foxtable.com/dispbbs.asp?boardid=2&Id=5469 中,只是顺序有所不同:
DataTables("课时名单").DataRows.Clear()
dim x as string
for i as integer = 1 to tables("课程表").cols.count -1
x = x & "|" & tables("课程表").cols(i).name
dim f As New Filler
f.SourceTable = DataTables("课程表") '指定数据来源
f.SourceCols = "" & tables("课程表").cols(i).name & "" '指定数据来源列
f.DataTable = DataTables("课时名单") '指定数据接收表
f.DataCols = "姓名" '指定数据接收列
f.Distinct = false
f.Fill() '填充数据
next
x=x.trim("|")
dim n as integer = tables("课程表").cols.count /x.split("|").length
for xi as integer = 0 to x.split("|").length-1
for ii as integer = xi*tables("课程表").rows.count to xi*tables("课程表").rows.count+tables("课程表").rows.count-1
tables("课时名单").rows(ii)("星期") = x.split("|")(xi).split("_")(0)
tables("课时名单").rows(ii)("计分") = 1
next
next
Messagebox.Show("处理完毕!")
原代码主要是慢在:
...................
Dim drmd As DataRow
drmd = DataTables("课时名单").DataRows.AddNew() ‘今后增加行数多时,尽量少用addnew!~
........................
只要代码合理,老爷机不是问题~ 估计c版的机子会在1秒以内的。
[此贴子已经被作者于2009-12-14 14:12:19编辑过]