以下是引用吹水佬在2023-4-11 19:46:03的发言:
先看看ColumnCount是什么,估计是 -1
我觉得问题是出在这里
sqlexec(nHandle,"select * from 历史统计双飞 where 用户名 = ALLTRIM(STR(&user_))","历史统计双飞")
我如果不加条件,就没问题,说明grid哪里没有问题,问题一定在这里,麻烦帮我看一下,版主,我一定要有这个条件,不然没法判断用户啊!
我还是附上代码
程序代码:
this.RecordSource='历史统计双飞'
this.setall("alignment",2,"column")&&内容居中
this.setall("alignment",2,"header")&&表头居中
this.setall("resizable",.f.,"column")&&禁止调整宽度
this.setall("movable",.f.,"column")&&禁止调整列前后
this.rowheight=28
this.Columns(1).width=70
this.Columns(2).width=30
this.Columns(3).width=30
this.Columns(4).width=30
this.Columns(5).width=30
this.Columns(6).width=30
this.Columns(7).width=30
this.Columns(8).width=29
this.Columns(9).width=30
this.Columns(10).width=30
this.Columns(11).width=30
this.Columns(12).width=30
this.Columns(13).width=30
this.Columns(14).width=30
this.Columns(15).width=30
this.Columns(16).width=30
this.Columns(17).width=30
this.Columns(18).width=30
this.Columns(19).width=30
this.Columns(20).width=30
this.Columns(21).width=30
this.Columns(22).width=30
this.Columns(23).width=30
this.Columns(24).width=30
this.Columns(25).width=30
this.Columns(26).width=30
this.Columns(27).width=30
this.Columns(28).width=30
this.Columns(29).width=30
this.Columns(30).width=30
this.Columns(31).width=30
this.Columns(32).width=30
this.Columns(33).width=30
this.Columns(34).width=30
this.Columns(35).width=30
this.Columns(36).width=30
this.Columns(37).width=30
this.Columns(38).width=30
this.Columns(39).width=30
this.Columns(40).width=30
this.Columns(41).width=30
this.Columns(42).width=30
this.Columns(43).width=30
this.Columns(44).width=30
this.Columns(45).width=30
this.Columns(46).width=30
this.Columns(47).width=30
this.Columns(48).width=30
this.Columns(49).width=30
this.Columns(50).width=30
this.Columns(51).width=30
this.Columns(52).width=30
this.Columns(53).width=30
this.Columns(54).width=30
this.Columns(55).width=30
this.Columns(56).width=30
this.Columns(1).backcolor=RGB(244,244,244)
This.COLUMNs(1).fontbold=.f.
This.COLUMN2.DynamicforeColor="icase(零零>=5,RGB(255,0,0),零零>=3,RGB(0,0,255),零零=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN3.DynamicforeColor="icase(零一>=5,RGB(255,0,0),零一>=3,RGB(0,0,255),零一=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN4.DynamicforeColor="icase(零二>=5,RGB(255,0,0),零二>=3,RGB(0,0,255),零二=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN5.DynamicforeColor="icase(零三>=5,RGB(255,0,0),零三>=3,RGB(0,0,255),零三=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN6.DynamicforeColor="icase(零四>=5,RGB(255,0,0),零四>=3,RGB(0,0,255),零四=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN7.DynamicforeColor="icase(零五>=5,RGB(255,0,0),零五>=3,RGB(0,0,255),零五=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN8.DynamicforeColor="icase(零六>=5,RGB(255,0,0),零六>=3,RGB(0,0,255),零六=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN9.DynamicforeColor="icase(零七>=5,RGB(255,0,0),零七>=3,RGB(0,0,255),零七=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN10.DynamicforeColor="icase(零八>=5,RGB(255,0,0),零八>=3,RGB(0,0,255),零八=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN11.DynamicforeColor="icase(零九>=5,RGB(255,0,0),零九>=3,RGB(0,0,255),零九=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN12.DynamicforeColor="icase(一一>=5,RGB(255,0,0),一一>=3,RGB(0,0,255),一一=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN13.DynamicforeColor="icase(一二>=5,RGB(255,0,0),一二>=3,RGB(0,0,255),一二=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN14.DynamicforeColor="icase(一三>=5,RGB(255,0,0),一三>=3,RGB(0,0,255),一三=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN15.DynamicforeColor="icase(一四>=5,RGB(255,0,0),一四>=3,RGB(0,0,255),一四=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN16.DynamicforeColor="icase(一五>=5,RGB(255,0,0),一五>=3,RGB(0,0,255),一五=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN17.DynamicforeColor="icase(一六>=5,RGB(255,0,0),一六>=3,RGB(0,0,255),一六=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN18.DynamicforeColor="icase(一七>=5,RGB(255,0,0),一七>=3,RGB(0,0,255),一七=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN19.DynamicforeColor="icase(一八>=5,RGB(255,0,0),一八>=3,RGB(0,0,255),一八=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN20.DynamicforeColor="icase(一九>=5,RGB(255,0,0),一九>=3,RGB(0,0,255),一九=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN21.DynamicforeColor="icase(二二>=5,RGB(255,0,0),二二>=3,RGB(0,0,255),二二=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN22.DynamicforeColor="icase(二三>=5,RGB(255,0,0),二三>=3,RGB(0,0,255),二三=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN23.DynamicforeColor="icase(二四>=5,RGB(255,0,0),二四>=3,RGB(0,0,255),二四=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN24.DynamicforeColor="icase(二五>=5,RGB(255,0,0),二五>=3,RGB(0,0,255),二五=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN25.DynamicforeColor="icase(二六>=5,RGB(255,0,0),二六>=3,RGB(0,0,255),二六=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN26.DynamicforeColor="icase(二七>=5,RGB(255,0,0),二七>=3,RGB(0,0,255),二七=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN27.DynamicforeColor="icase(二八>=5,RGB(255,0,0),二八>=3,RGB(0,0,255),二八=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN28.DynamicforeColor="icase(二九>=5,RGB(255,0,0),二九>=3,RGB(0,0,255),二九=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN29.DynamicforeColor="icase(三三>=5,RGB(255,0,0),三三>=3,RGB(0,0,255),三三=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN30.DynamicforeColor="icase(三四>=5,RGB(255,0,0),三四>=3,RGB(0,0,255),三四=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN31.DynamicforeColor="icase(三五>=5,RGB(255,0,0),三五>=3,RGB(0,0,255),三五=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN32.DynamicforeColor="icase(三六>=5,RGB(255,0,0),三六>=3,RGB(0,0,255),三六=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN33.DynamicforeColor="icase(三七>=5,RGB(255,0,0),三七>=3,RGB(0,0,255),三七=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN34.DynamicforeColor="icase(三八>=5,RGB(255,0,0),三八>=3,RGB(0,0,255),三八=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN35.DynamicforeColor="icase(三九>=5,RGB(255,0,0),三九>=3,RGB(0,0,255),三九=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN36.DynamicforeColor="icase(四四>=5,RGB(255,0,0),四四>=3,RGB(0,0,255),四四=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN37.DynamicforeColor="icase(四五>=5,RGB(255,0,0),四五>=3,RGB(0,0,255),四五=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN38.DynamicforeColor="icase(四六>=5,RGB(255,0,0),四六>=3,RGB(0,0,255),四六=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN39.DynamicforeColor="icase(四七>=5,RGB(255,0,0),四七>=3,RGB(0,0,255),四七=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN40.DynamicforeColor="icase(四八>=5,RGB(255,0,0),四八>=3,RGB(0,0,255),四八=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN41.DynamicforeColor="icase(四九>=5,RGB(255,0,0),四九>=3,RGB(0,0,255),四九=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN42.DynamicforeColor="icase(五五>=5,RGB(255,0,0),五五>=3,RGB(0,0,255),五五=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN43.DynamicforeColor="icase(五六>=5,RGB(255,0,0),五六>=3,RGB(0,0,255),五六=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN44.DynamicforeColor="icase(五七>=5,RGB(255,0,0),五七>=3,RGB(0,0,255),五七=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN45.DynamicforeColor="icase(五八>=5,RGB(255,0,0),五八>=3,RGB(0,0,255),五八=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN46.DynamicforeColor="icase(五九>=5,RGB(255,0,0),五九>=3,RGB(0,0,255),五九=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN47.DynamicforeColor="icase(六六>=5,RGB(255,0,0),六六>=3,RGB(0,0,255),六六=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN48.DynamicforeColor="icase(六七>=5,RGB(255,0,0),六七>=3,RGB(0,0,255),六七=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN49.DynamicforeColor="icase(六八>=5,RGB(255,0,0),六八>=3,RGB(0,0,255),六八=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN50.DynamicforeColor="icase(六九>=5,RGB(255,0,0),六九>=3,RGB(0,0,255),六九=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN51.DynamicforeColor="icase(七七>=5,RGB(255,0,0),七七>=3,RGB(0,0,255),七七=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN52.DynamicforeColor="icase(七八>=5,RGB(255,0,0),七八>=3,RGB(0,0,255),七八=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN53.DynamicforeColor="icase(七九>=5,RGB(255,0,0),七九>=3,RGB(0,0,255),七九=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN54.DynamicforeColor="icase(八八>=5,RGB(255,0,0),八八>=3,RGB(0,0,255),八八=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN55.DynamicforeColor="icase(八九>=5,RGB(255,0,0),八九>=3,RGB(0,0,255),八九=0,RGB(255,255,255),RGB(75,75,75))"
This.COLUMN56.DynamicforeColor="icase(九九>=5,RGB(255,0,0),九九>=3,RGB(0,0,255),九九=0,RGB(255,255,255),RGB(75,75,75))"
表格都是美化代码,都没有其他的
[此贴子已经被作者于2023-4-11 21:17编辑过]