dbgrid的Dgmultiselect 设为true,按住ctrl键就可以用鼠标选择了。刚巧用过。
j:=DBGrid1.SelectedRows.Count;
with DBGrid1.DataSource.DataSetdo
for i:=0 to DBGrid1.SelectedRows.Count-1do
begin
GotoBookmark(pointer(DBGrid1.SelectedRows.Items));
DBGrid1.DataSource.DataSet.Edit;
if DBGrid1.DataSource.DataSet.CanModify then
DBGrid1.DataSource.DataSet.FieldByName('A1').AsInteger:=500;
end;
DBGrid1.DataSource.DataSet.Refresh;
//删除标志位500的行
for i:=0 to jdo
if table1.Locate('A1','500',[loPartialKey]) and table1.CanModify then
begin
table1.Delete;
end;
DBGrid1.SelectedRows.Clear;