求助:VFP+SQL 插入记录到SQL,记录重复问题
各位前辈,我从VFP里面操作,将本地的记录上传到SQL,但是SQL查询显示上传的记录是重复的,不知道原因,请前辈们帮忙指导下,谢谢程序代码:
SQLSETPROP(glognhandle,"Transactions" ,2)&& 开始一个事务 ****清空pzdr记录 csql="TRUNCATE TABLE &clbl(1)" &&清空wclpz记录 If SQLExec(glognhandle,csql)<0 =Messagebox(" 清空&clbl(1)记录出错! ",16,"错误提示!") =Sqlrollback(glognhandle) Return ENDIF *****传送wpzdr scan csql="INSERT INTO &clbl(1).(id,clpz,xx) VALUES ('"+wpzdr.id+"','"+wpzdr.clpz+"','"+wpzdr.xx+"')" IRETURN=SQLEXEC(glognhandle,cSQL) If SQLExec(glognhandle,csql)<0 =Messagebox(" &clbl(1).保存数据出错! ",16,"错误提示!") =Sqlrollback(glognhandle) Return ENDIF endscan ****删除头行 csql="DELETE from &clbl(1). where &clbl(1)..id='id'" IRETURN=SQLEXEC(glognhandle,cSQL) If SQLExec(glognhandle,csql)<0 =Messagebox(" &clbl(1).删除头行数据出错! ",16,"错误提示!") =Sqlrollback(glognhandle) Return ENDIF SQLSetprop(glognhandle,"Transactions" ,1)&& 重新回到自动事务处理状态