在打开表1、表2之后,拷贝表1结构生成表3;
与表1表2对应,生成两个临时表Temp1.dbf、Temp2.dbf;
打开表3,从临时表录入全部记录;
删除临时表;
用程序自动删除重复数据。
主要代码:
* Command1-Click
CLOSE DATABASES
SELECT 1
gcTable=GETFILE('DBF')
USE (gcTable) ALIAS aa
thisform.grid1.RecordSource = [aa]
thisform.grid1.SetFocus
.T.
* Command2-Click
SELECT 2
gcTable1=GETFILE('DBF')
SELECT 1
IF gcTable1=[aa]
RETURN
ELSE
SELECT 2
gcTable=gcTable1
ENDIF
USE (gcTable) ALIAS bb
thisform.grid2.RecordSource = [bb]
thisform.grid2.SetFocus
.F.
* Command3-Click
SELECT 1
COPY TO Temp1
COPY STRUCTURE TO 3
SELECT 2
COPY TO Temp2
SELECT 1
SELECT 3
USE 3
APPEND FROM Temp1
APPEND FROM Temp2
ERASE Temp1.*
ERASE Temp2.*
I=1
DO WHILE I<=RECCOUNT()
GO TOP
SKIP I-1
IF !DELETED()
X=FIELD(1)
XX=&X
Y=FIELD(2)
YY=&Y
DELETE ALL FOR RECNO()>I AND &X=XX AND &Y=YY
ENDIF
I=I+1
ENDDO
PACK
CLOSE DATABASES
USE 3 ALIAS cc
thisform.grid1.RecordSource = [cc]
thisform.grid1.SetFocus
.F.
.F.