pb开发程序,使用odbc连接一堆dbf,delete某表之后,dbf中记录作了删除标记,但是无法执行pack,进行彻底删除,看到网上有人提出的解决方案,我照写如下:
ls_sql = " pack "+ls_tablename+".dbf"
EXECUTE IMMEDIATE :ls_sql using sqlca;
if sqlca.sqlcode<0 then
ls_err=string(sqlca.sqlcode)+";"+sqlca.sqlerrtext
messagebox('错误信息',"pack时出错!~n"+ls_err,stopsign!)
return
end if
但执行时提示:file is in use,请教高人帮忙解决一下!
------解决方案--------------------
disconnect ;
connect;
ls_sql = " pack "+ls_tablename+".dbf"
sqlca.AutoCommit = TRUE
EXECUTE IMMEDIATE :ls_sql using sqlca;
if sqlca.sqlcode<0 then
ls_err=string(sqlca.sqlcode)+";"+sqlca.sqlerrtext
messagebox('错误信息',"pack时出错!~n"+ls_err,stopsign!)
return
end if
sqlca.AutoCommit = False
delete后要先断开数据库连接,然后再连接