|
-
Aug 9th, 2012, 06:15 PM
#2
Re: Deleting Selected Row in Flexgrid Base On Another Flexgrid VB 6.0
Try to be more clear in your threads, you said grid1 and grid, then the snapshot shows grid1 and grid2.
There is a remove button in that grid1 that should simply delete the selected record in grid1, the other logic step would be also delete the corresponding records from grid2, but i don't think this is what you mean because you're also talking about a column, so i have no idea what you're trying to do here.
Also have in mind: It's a bad practice just removing the row from the grid when a record is deleted by the user, the best would be first executing the DELETE command in the database to remove that record and then clearing the grid and reloading all records, this is something more "atomic" and better. The problem with just deleting the row from the grid by code (when working with databases) is: imagine for some reason the record in the db is not deleted, like any given error, then you delete the row from the grid anyway, so the grid is not showing the real state of the db and vice-versa, and there you'll get data corruption, inconsistencies, etc..
Also, if this is gonna be a 2 step command execution to the db, like 2 delete commands, then you should use a transaction for doing this, again the idea is keeping things as atomic as posible, meaning: everything is executed or nothing is executed, this means that if there is an error then everything will return to previous state (Connection.rollback), else all commands will execute (Connection.Commit), this is what transactions are for.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|