0

OK. I have simple Database ,DBGrid and DBNavigator . I use this code for my adoquery and view in this in my DBGrid

select Count(*)As 1 , 2 3 from Table1 Group by 1, 2

The problem is that if i have two or more the same article from 1 and i try to delete it from DBnavigator it send me

Key column information is insufficient or incorrect.Too many rows were affected by update. I want to delete two or more rows.Not only one. How to fix that ?

Georgi Gavrilski
  • 31
  • 1
  • 1
  • 3

1 Answers1

0

I guess it won't be possible using DBNavigator in a usual way (without override delete button event), because the dataset holds more than one record in a DBGrid row and IMHO the grid doesn't take care if you have data in a group. I would say if you select some grouped row and try to delete it, "DBNavigator" checks if there is some primary (unique) key for a row, but in this case, there is no one.

But it's just my notion, I can't verify it now.

  • If this is no possible using dvNavigator ,how to do it ? – Georgi Gavrilski Feb 04 '11 at 15:02
  • 1
    @Georgi - The `Delete` method of `TDataSet` is for deleting the *active* record, the DataSet needs to locate a *unique* record for deletion. Construct a query with a `delete from...` sql to your liking and open it.. – Sertac Akyuz Feb 04 '11 at 15:57