试了一下 recordsourcetype=4 好象无什么异常
** thisform.myClick 自定义表单方法,点击表格各栏目排序
LOCAL aCol[1]
IF (AEVENTS(aCol,0) > 0)
IF (VARTYPE(aCol[1])=="O") AND (PROPER(aCol[1].BaseClass)=="Header")
this.grid1.RecordSource = "SELECT * FROM cp2013 ORDER BY " +;
JUSTEXT(aCol[1].Parent.ControlSource) +;
IIF(this.Ascending, " ASC ", " DESC ") +;
"INTO CURSOR grid1_tmp READWRITE"
this.grid1.SetFocus
this.Ascending = !this.Ascending &&自定义属性Ascending,升降序切换
ENDIF
ENDIF
** thisform.Init
this.grid1.RecordSourceType = 4
this.grid1.RecordSource = "SELECT * FROM cp2013 INTO CURSOR grid1_tmp READWRITE"
FOR EACH oColumn IN this.grid1.Columns
BINDEVENT(oColumn.Header1, "Click", this, "myClick")
ENDFOR