有两个Access数据表ADOTable1和ADOTable2,ADOTable1表有键值、ADOTable2表无键值,为何以下删除表记录的程序第一段正常,而删除ADOTable2的程序段报错:
“键列信息不足或不正确。更新影响到多行”,请问这是何原因?
with ADOTable1 do
begin
if RecordCount>0 then
begin
first;
while not eof do delete;
end;
end;
with ADOTable2 do
begin
if RecordCount>0 then
begin
first;
while not eof do delete;
end;
end;
“键列信息不足或不正确。更新影响到多行”,请问这是何原因?
with ADOTable1 do
begin
if RecordCount>0 then
begin
first;
while not eof do delete;
end;
end;
with ADOTable2 do
begin
if RecordCount>0 then
begin
first;
while not eof do delete;
end;
end;
解决方案 »
- 请问函数形参是对象的话,这个对象是值还是址?
- 菜鸟初学通讯编程,工控机接口UDP 的简单问题,快来拿分咯!
- 在delphi程序中打开资源管理器,能否控制资源管理器的显示位置和大小
- dll
- 各位大虾请帮忙!
- 怎么用DELPHI实现RS232串口通讯实现一次发送九位信息?谢谢,急急急!
- 请教OpenDialog对话框位置问题
- 关于BusinessSkinForm皮肤的问题
- 如何把一个字段的内容求和,然后把结果存入另一表!
- 怎样用虚拟键盘输入中文啊!!!DELPHI高手有知道的么????
- 汗,一个棘手的问题
- Delphi6写的调用C#的WebService的Dll,在XP下可以,Win2003下为什么不行呢?
adoTable.Connection.Execute('Delete From .. Where ...');
这样试试
with ADOTable2 do
begin
if RecordCount>0 then
begin
Last;
while not bof do delete;
end;
end;
或者执行sQL语句
//删除的时候是需要从后往前删。
with Adotable1 do
begin
Last;
while not bof do
begin
Delete;
prior;
end;
end;//另外全部删除可以用如下方法
AdOTable1.Connection.Execute('Delete from '+AdoTable1.TableName);
adotable1.refresh;
adoTable2 在刪除前,先 AdoTable2.ReQuery 下,如果還是出錯,有可能是這個表沒有主鍵。
及ADOTable1.open;
ADOTable1.edit;
kk:=ADOTable1.Recorcount;
for kk:=1 to kk do
ADOTable1.delete;
...修改记录内容;
...post;