有关paradox数据表的问题?(急!)(100分)

  • 主题发起人 主题发起人 wind.prince
  • 开始时间 开始时间
W

wind.prince

Unregistered / Unconfirmed
GUEST, unregistred user!
我在win2000下用Delphi6自带的Paradox建立一张表,
我的程序通过此表与另一个程序进行交互。我在此表
中设立一个标志字段,当我向表中添加一条记录时,
就将该字段设为‘0’,当另一个程序访问完该记录后
就将其改为‘1’。我的程序一发现其改为1后就将该
记录删除。我用的是table的append、post和delete
方法。另一个程序是用VC编写的,用odbc和update方法。
可是每次用update将其改为1时,都不成功,说不存在。
而我的程序确实判断其改为1时才删除的。请问各位大侠
们,这是为什么?
 
paradox可能不能同时打开,进行相关操作
 
paradox用post保存时,实际上并没有真正写到表中,必须关掉表或者update才能真正写到
表中。
 
我用了table.close方法也不行呀

paradox表是不是一定用缓存呀
 
我想是不是delete的问题,他不是物理删除!
有没有别的方法进行物理删除呀?请给出详细代码
 
Paradox并不是物理删除数据
参考一下这个
// Pack a Paradox or dBASE table
// The table must be opened execlusively before calling this function...
procedure PackTable(Table: TTable);
var
Props: CURProps;
hDb: hDBIDb;
TableDesc: CRTblDesc;
begin
// Make sure the table is open exclusively so we can get the db handle...
if not Table.Active then
raise EDatabaseError.Create('Table must be opened to pack');
if not Table.Exclusive then
raise EDatabaseError.Create('Table must be opened exclusively to pack');

// Get the table properties to determine table type...
Check(DbiGetCursorProps(Table.Handle, Props));

// If the table is a Paradox table, you must call DbiDoRestructure...
if Props.szTableType = szPARADOX then begin
// Blank out the structure...
FillChar(TableDesc, sizeof(TableDesc), 0);
// Get the database handle from the table's cursor handle...

Check(DbiGetObjFromObj(hDBIObj(Table.Handle), objDATABASE, hDBIObj(hDb)));
// Put the table name in the table descriptor...
StrPCopy(TableDesc.szTblName, Table.TableName);
// Put the table type in the table descriptor...
StrPCopy(TableDesc.szTblType, Props.szTableType);
// Set the Pack option in the table descriptor to TRUE...
TableDesc.bPack := True;
// Close the table so the restructure can complete...
Table.Close;
// Call DbiDoRestructure...
Check(DbiDoRestructure(hDb, 1, @TableDesc, nil, nil, nil, False));
end
else
// If the table is a dBASE table, simply call DbiPackTable...
if (Props.szTableType = szDBASE) then
Check(DbiPackTable(Table.DBHandle, Table.Handle, nil, szDBASE, True))
else
// Pack only works on PAradox or dBASE; nothing else...
raise EDatabaseError.Create('Table must be either of Paradox or dBASE ' +
'type to pack');
Table.Open;
end;
 
后退
顶部