陈百祥爱国完整视频:数据比较程序,请教如何修改?

来源:百度文库 编辑:神马品牌网 时间:2024/04/28 03:05:33
以下是一个数据比较程序,通过文本框text1和text2来获得两个文件的地址,请问如何改正才能正确运行?(两表结构相同,项目相同,只比较数据的不同)
知情者请去http://zhidao.baidu.com/question/235191.html
回答领分
clos data
thisform.msg.caption="检查文件是否存在..."
file1=allt(thisform.text1.value)
if !file('&file1')
messagebox("表1“&file1.”不存在,请重新选择!",16,"错误")
thisform.text1.setfocus
retu
endif
file2=allt(thisform.text2.value)
if !file('&file2')
messagebox("表2“&file2.”不存在,请重新选择",16,"错误")
thisform.text2.setfocus
retu
endif
if file1=file2
messagebox("表1“&file1.”和表2“&file2.”不能选择同一个表",16,"错误")
retu
endif
select "&file2" &&你可改成你的表名
nSecFcount=file2
select "&file1" &&你可改成你的表名
nMainFcount=file1
nField=0 &&定义判断表相同字段及结构的数量
IF nSecFcount=nMainFcount
FOR i=1 TO nSecFcount
SELECT "&file2"
lcSec=FIELD(i)
lvSec=&lcSec
FOR j=1 TO nMainFcount
SELECT "&file1"
lcMain=FIELD(j)
lvMain=&lcMain
IF UPPER(ALLTRIM(lcSec))=UPPER(ALLTRIM(lcMain)) AND TYPE('lvSec')#TYPE('lvMain')
nField=nField+1 &&有相同结构及名字的字段加1
ENDIF
ENDFOR
ENDFOR
ELSE
nField=0
ENDIF

IF nField=0 OR nField#nSecFcount
MESSAGEBOX("两个表的字段名或数据结构不同,不能比较",64,"提示信息")
RETURN
ENDIF
*查询相同记录,主键不是memo类都可以
Select * from "&file2" where exis (SELECT * from "&file2" group by sbh having count(*)>1) order by sbh into table Samedbf
*查询不相同记录,主键不是memo类都可以
Select * from "&file1" where exis (SELECT * from "&file1" group by sbh having count(*)=1) order by sbh into table Difdbf