6. asp.net 程序在 page_load 事件里读取要排序的字段 sort_field,然后对水晶报表进行排序。
7. 水晶报表排序编程实例
dim crreportdocument as reportdocument
public sub changesortfield(mysortfld as string, mysortdir as string)
dim crsortfield as sortfield dim crsortdirection as sortdirection dim crdatabasefielddefinition as databasefielddefinition
for each crsortfield in crreportdocument.datadefinition.sortfields if crsortfield.field.name.tostring = mysortfld then crdatabasefielddefinition = crreportdocument.database.tables(0).fields(mysortfld.tostring) crsortfield = crreportdocument.datadefinition.sortfields(0) crsortfield.field = crdatabasefielddefinition
if mysortdir = "ascending" then crsortfield.sortdirection = sortdirection.ascendingorder else crsortfield.sortdirection = sortdirection.descendingorder end if end if next
crystalreportviewer1.reportsource = crreportdocument end sub ,欢迎访问网页设计爱好者web开发。