columns不是一个对象,这个问题怎么解决
表单里面有两个表格控件,grid1和grid2表单里面有个查询按钮
代码如下:
程序代码:
if empty(thisform.pageframe1.page1.pageframe1.page1.text1.Value) MESSAGEBOX("要查询的数据不能为空,请填写数据后在查询",16,"系统提示") thisform.pageframe1.page1.pageframe1.page1.text1.SetFocus ELSE a=ALLTRIM(thisform.pageframe1.page1.pageframe1.page1.text1.Value) b=thisform.pageframe1.page1.pageframe1. CASE CASE b="历史同期" thisform.pageframe1.page1.pageframe1.page1.grid1.RecordSource='' SELECT * from 本地数据 WHERE 期号 like "%"+a INTO CURSOR 历史 SELECT 历史 c=RECCOUNT() IF c<1 USE MESSAGEBOX("数据库中不存在您要查找的数据!",16,"系统提示") thisform.pageframe1.page1.pageframe1.page1.text1.Value='' thisform.pageframe1.page1.pageframe1.page1.grid1.RecordSource='' thisform.pageframe1.page1.pageframe1.page1.grid1.RecordSource='本地数据' thisform.pageframe1.page1.pageframe1.page1.grid1.SetFocus ELSE COUNT FOR 零='〇' to n1 COUNT FOR 一='①' to n2 COUNT FOR 二='②' to n3 COUNT FOR 三='③' to n4 COUNT FOR 四='④' to n5 COUNT FOR 五='⑤' to n6 COUNT FOR 六='⑥' to n7 COUNT FOR 七='⑦' to n8 COUNT FOR 八='⑧' to n9 COUNT FOR 九='⑨' to n10 chuxiancishu="出现次数" sqlexec(nHandle,"update 历史同期统计 set 零=?n1 where 常规=?chuxiancishu") sqlexec(nHandle,"update 历史同期统计 set 一=?n2 where 常规=?chuxiancishu") sqlexec(nHandle,"update 历史同期统计 set 二=?n3 where 常规=?chuxiancishu") sqlexec(nHandle,"update 历史同期统计 set 三=?n4 where 常规=?chuxiancishu") sqlexec(nHandle,"update 历史同期统计 set 四=?n5 where 常规=?chuxiancishu") sqlexec(nHandle,"update 历史同期统计 set 五=?n6 where 常规=?chuxiancishu") sqlexec(nHandle,"update 历史同期统计 set 六=?n7 where 常规=?chuxiancishu") sqlexec(nHandle,"update 历史同期统计 set 七=?n8 where 常规=?chuxiancishu") sqlexec(nHandle,"update 历史同期统计 set 八=?n9 where 常规=?chuxiancishu") sqlexec(nHandle,"update 历史同期统计 set 九=?n10 where 常规=?chuxiancishu") sqlexec(nHandle,"select * from 历史同期统计","历史同期统计") thisform.pageframe1.page1.pageframe1.page1.grid2.Init thisform.pageframe1.page1.pageframe1.page1.grid2.RecordSource='历史同期统计' thisform.pageframe1.page1.pageframe1.page1.grid2.Visible= .T. thisform.pageframe1.page1.pageframe1.page1.grid1.RecordSource='' thisform.pageframe1.page1.pageframe1.page1.grid1.RecordSource='历史' SELECT 历史 GO TOP thisform.pageframe1.page1.pageframe1.page1.grid1.Init thisform.pageframe1.page1.pageframe1.page1.Init thisform.pageframe1.page1.pageframe1.page1.grid1.Refresh thisform.pageframe1.page1.pageframe1.page1.grid1.SetFocus ENDIF CASE b="期号" thisform.pageframe1.page1.pageframe1.page1.grid1.RecordSource='' SELECT * from 本地数据 WHERE 期号 like a INTO CURSOR 期号 SELECT 期号 c=RECCOUNT() IF c<1 USE MESSAGEBOX("数据库中不存在您要查找的数据!",16,"系统提示") thisform.pageframe1.page1.pageframe1.page1.text1.Value='' thisform.pageframe1.page1.pageframe1.page1.grid1.RecordSource='' thisform.pageframe1.page1.pageframe1.page1.grid1.RecordSource='本地数据' thisform.pageframe1.page1.pageframe1.page1.grid1.SetFocus ELSE thisform.pageframe1.page1.pageframe1.page1.grid1.RecordSource='期号' thisform.pageframe1.page1.pageframe1.page1.grid1.Init thisform.pageframe1.page1.pageframe1.page1.Init thisform.pageframe1.page1.pageframe1.page1.grid1.Refresh thisform.pageframe1.page1.pageframe1.page1.grid1.SetFocus ENDIF CASE b="试机号" thisform.pageframe1.page1.pageframe1.page1.grid1.RecordSource='' SELECT * from 本地数据 WHERE 试机号 like a INTO CURSOR 试机号 SELECT 试机号 c=RECCOUNT() IF c<1 USE MESSAGEBOX("数据库中不存在您要查找的数据",16,"系统提示") thisform.pageframe1.page1.pageframe1.page1.text1.Value='' thisform.pageframe1.page1.pageframe1.page1.grid1.RecordSource='' thisform.pageframe1.page1.pageframe1.page1.grid1.RecordSource='本地数据' thisform.pageframe1.page1.pageframe1.page1.grid1.SetFocus ELSE thisform.pageframe1.page1.pageframe1.page1.grid1.RecordSource='试机号' thisform.pageframe1.page1.pageframe1.page1.grid1.Init thisform.pageframe1.page1.pageframe1.page1.Init thisform.pageframe1.page1.pageframe1.page1.grid1.Refresh thisform.pageframe1.page1.pageframe1.page1.grid1.SetFocus ENDIF CASE b="开奖号" thisform.pageframe1.page1.pageframe1.page1.grid1.RecordSource='' SELECT * from 本地数据 WHERE 开奖号 like a INTO CURSOR 开奖号 SELECT 开奖号 c=RECCOUNT() IF c<1 USE MESSAGEBOX("数据库中不存在您要查找的数据",16,"系统提示") thisform.pageframe1.page1.pageframe1.page1.text1.Value='' thisform.pageframe1.page1.pageframe1.page1.grid1.RecordSource='' thisform.pageframe1.page1.pageframe1.page1.grid1.RecordSource='本地数据' thisform.pageframe1.page1.pageframe1.page1.grid1.SetFocus ELSE thisform.pageframe1.page1.pageframe1.page1.grid1.RecordSource='开奖号' thisform.pageframe1.page1.pageframe1.page1.grid1.Init thisform.pageframe1.page1.pageframe1.page1.Init thisform.pageframe1.page1.pageframe1.page1.grid1.Refresh thisform.pageframe1.page1.pageframe1.page1.grid1.SetFocus ENDIF ENDCASE ENDIF
下面是grid1和grid2的init代码
程序代码:
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).backcolor=RGB(247,247,247) this.Columns(1).width=290 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=30 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
问题:第一次查询,是正常的,当第二查询就报错columns不是一个对象,请教各位这个怎么解决!
就是当连续查询的时候会报错,grid2报错,grid1不报错!头痛了