Page 1 of 1

how can I delete records in dbgrid?

Posted: 26.02.2009, 05:53
by lukezeoslib
I am using fb 2.1.1 + zeos 6.6.4 + tdbgrid

After I selected multilines from the tdbgrid, I tried many way to delete the selected records, but they were still there... :(

Posted: 26.02.2009, 07:55
by nostradumbass
Read the PrimaryKey for each row from the DBGrid, and use it as a parameter to a stored procedure (TZStoredProc component) with a Delete SQL statement.

If the DBGrid is linked to a dataset (ideal situation), then you can read the primary key from the associated column in the dataset.

Posted: 26.02.2009, 08:06
by lukezeoslib
Thank you, nostradumbass ...

I just wonder why I can't use the bookmark in this case?

Posted: 26.02.2009, 09:03
by lukezeoslib
I don't know what's happened. Just 5 minutes ago, I rewrited the program, and result is ok. I am not sure where is the problem. The demo program was still a simple program, in this time, even I called the 'dbgrid.selectrows.delete', the selected records were gone!!!

I will try to recompile the zeoslib components, because I used a simplify version(without supporting other database, just left fb and ib) components before, it gave me a unwanted reason and, after that I recompiled and installed the full version of zeoslib...I guest and do not hope that is the reason.

Posted: 26.02.2009, 09:48
by mdaems
Were you using cached updates? In that case you need to call applyupdates to get the data on the database server. Maybe that was different between the 2 tries?

Using a smaller version (excluding some databases) shouldn't change this at all. This only removes some units on the dbc level, not the component level. grids/datasets/... are component level.

Mark