分享

关于查询要点

 悟静 2009-06-14
1、用文本框作为输入日期 时,在init中设置 text.value ={}

2、在设置条件时注意表达出各个部分之间的空格。" "=" "   where &......用到&无空连接。

3、注意 = 为赋值,==为值等于。

4、在二个日期之间查询:
    先设置了二个文本框{}
   Select * from 人员信息表 where 出生日期;
	  between thisform.text1.value and thisform.text2.value;
	  into cursor 临时人员信息表
5、resourse="表名"  注意引号 类型为-2      ="selecte....."    tye  -4      
6、查找: locate for a=b 表示查找a=b的记录
7、sele 临时人员信息表
      sele表名
      thisform.text2.value=reccount()
     sum(基本工资) to toxt3.value
     aver(基本工资) to thisform.text4.value
8、组合框中type为-1时,连接的源为值。源="值1,值2,。。。"
9、关于汇总的代码:

“汇总”按钮command1的click事件代码:对各部门进行统计)

private CXTJ,TJ
CXTJ=thisform.combo1.displayvalue
if empty(CXTJ)   && 判断列表框和文本框是否为空 
    messagebox('请输入完整条件!',16,'系统提示')
   thisform.combo1.setfocus
else
   do case 
   case alltrim(CXTJ)='部门'
      TJ='部门,count(编号) as 人数,sum(基本工资)as 总工资,;
      avg(基本工资)as 平均工资,count(编号)/reccount()*100 as 百分比'
   case alltrim(CXTJ)='性别'
      TJ='性别,count(编号) as 人数,sum(基本工资)as 总工资,;
      avg(基本工资)as 平均工资,count(编号)/reccount()*100 as 百分比'
   case alltrim(CXTJ)='学历' 
      TJ='学历 as 学历,count(编号) as 人数,count(编号)/reccount()*100 as 百分比'
   endcase	
   sc='into cursor 查询结果'
   Select &tj. from 人员信息表;      注意:&TJ. 二边的符号
   Group By &cxtj. &sc.
   thisform.Grid1.columncount=-1
   thisform.grid1.recordsource='查询结果'
   thisform.grid1.backcolor=rgb(200,224,248)
   thisform.grid1.refresh
endif
10、在看别人的代码时,引号:单、双都一样,关键是成对。要理解是"界定"的意义。
11、

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多