第一个“查询1”表单INIT事件代码:
------------------------------------------------------------------------------------------------------------------------------------------
nhandle=SQLSTRINGCONNECT('DRIVER=SQL SERVER;SERVER=*.*.*.*;UID=sa;PWD=sa;database=tz')
      &&nhandle 在MAIN.PRG已经设为全局变量
SQLEXEC(nhandle,'select * from chufa','cf')
 SELECT cf
 COUNT TO LSJL
 GO 1
 this.lbjl.Caption=ALLTRIM(STR(lsjl))
     &&用来统计临时表记录数,在表单上显示。
this.grid1.recordsource='cf'
 this.grid1.column1.header1.caption='名称'
 .......
this.grid1.column6.header1.caption='日期'
  &&共计6列
.......
this.grid1.headerheight=25
 this.grid1.readonly=.t.
 SQLDISCONNECT(handle)
 -------------------------------------------------------------------------------------------------------------------------------------------------------
第二个“查询2”表单查询INIT事件代码:
nhandle=SQLSTRINGCONNECT('DRIVER=SQL SERVER;SERVER=*.*.*.*;UID=sa;PWD=sa;database=tz')
      &&nhandle 在MAIN.PRG已经设为全局变量
SQLEXEC(nhandle,'select * from zhuxiao','zx')
 SELECT zx
 COUNT TO LSJL
 GO 1
 this.lbjl.Caption=ALLTRIM(STR(lsjl))
     &&用来统计临时表记录数,在表单上显示。
this.grid1.recordsource='zx'
 this.grid1.column1.header1.caption='识别号'
 .......
this.grid1.column7.header1.caption='人员'
  &&共计 7列
.......
this.grid1.headerheight=25
 this.grid1.readonly=.t.
 SQLDISCONNECT(handle)
 ------------------------------------------------------------------------------------------------------------------------
红色字体那个地方是我上次在这里写的时候着急写错了,源代码是正确的。不是这个地方的原因