how can I delete records in dbgrid?

Forum related to Firebird

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
lukezeoslib
Fresh Boarder
Fresh Boarder
Posts: 16
Joined: 22.02.2009, 17:21

how can I delete records in dbgrid?

Post 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... :(
nostradumbass
Junior Boarder
Junior Boarder
Posts: 27
Joined: 22.05.2008, 23:54

Post 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.
lukezeoslib
Fresh Boarder
Fresh Boarder
Posts: 16
Joined: 22.02.2009, 17:21

Post by lukezeoslib »

Thank you, nostradumbass ...

I just wonder why I can't use the bookmark in this case?
lukezeoslib
Fresh Boarder
Fresh Boarder
Posts: 16
Joined: 22.02.2009, 17:21

Post 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.
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post 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
Image
Post Reply