为什么提示:adq1:dataset not in edit or insert mode
procedure TForm1.Button1Click(Sender: TObject);
begin
while not adq1.Eof do
begin
if (leftstr(adq1hm.Value,2)<>'13') or (leftstr(adq1hm.Value,2)<>'86') then
begin
adq1.Edit;
adq1.Delete;
adq1.post;
end;
adq1.Next;
end;
end;
想去掉以13或86开头的记录。
procedure TForm1.Button1Click(Sender: TObject);
begin
while not adq1.Eof do
begin
if (leftstr(adq1hm.Value,2)<>'13') or (leftstr(adq1hm.Value,2)<>'86') then
begin
adq1.Edit;
adq1.Delete;
adq1.post;
end;
adq1.Next;
end;
end;
想去掉以13或86开头的记录。
begin
close;
sql.text := ' delete from table where (col1 like '13%' or col1 like '86%')';
execsql;
end;直接用SQL语句删除不好吗?
试试在adq1.Edit; 前面加个Adq1.open先··
为什么提示:adq1:dataset not in edit or insert mode
procedure TForm1.Button1Click(Sender: TObject);
begin
while not adq1.Eof do
begin
//if (leftstr(adq1hm.Value,2) <>'13') or (leftstr(adq1hm.Value,2) <>'86') then
if (leftstr(adq1hm.Value,2) ='13') or (leftstr(adq1hm.Value,2) ='86')
begin
//adq1.Edit;
adq1.Delete;
//adq1.post;
end;
adq1.Next;
end;
end;
想去掉以13或86开头的记录。
你的算法與你要的結果好像不一樣。
adq1.Edit;
adq1.post;
用来修改的