Click here to Skip to main content
13,003,150 members (58,681 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I am having one concept i.e.

[1] 2 combo boxes combo1(shows items from database) , combo2(shows marked as deleted items) n 1 listview control(shows items details) on form.

[2] I select an item from combo1 n whenever I clicked delete button the item from combo1 gets removed n will be appeared in combo2 also removed from listview control but not deleted from the database itself.....

[3] I hv tried lots of tricks bt no one gives appropriate result

plz help.......
Posted 15-Mar-13 21:31pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

How to mark items as deleted not originally delete from database?
Define a new column of bit type in your database for ever record in a table.
Bit field will hold either true or false. By default, set this flag value as false to indicate active and valid. Once you delete it from frontend, set this field to 'true' to mark as deleted.

Now, during data retrieval from DB, use this field as one of the WHERE clause condition, ex:
-- IsDelete is the BIT field defined
SELECT * FROM myTable WHERE IsDelete = false
cool_sari 16-Mar-13 5:06am
I don't understand.....
I hv to add field in table n in front-end also?
I hv tried this one bt it's not working....

Private Sub BtnDelete1_Click()
Combo3.AddItem "" & Combo4.Text & ""
If Combo4.ListCount Then Combo4.RemoveItem Combo4.ListIndex
MsgBox "Record Deleted Successfully ", vbInformation, "Deletion Successful"
End Sub
Sandeep Mewara 16-Mar-13 5:14am
Which part of the answer was unclear?
You need to add a field in database table. When you retrieve data, just get the data that is not marked as deleted. No change in frontend - everything as is. Only change in DB table and the query to get data.
When marking anything deleted in frontend, update that field in DB as deleted for that record.
cool_sari 16-Mar-13 5:21am
so I don't need to use removeitem property of combo box.
Sandeep Mewara 16-Mar-13 5:24am
You don't need to if you are re-fetching/binding the data after delete. If you don't rebind then you need to do removeitem and also set isdeleted flag in DB such that in future when you retrieve data you don't get that data.
cool_sari 16-Mar-13 5:29am
ya i'll re-fetch that data in future

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170626.1 | Last Updated 16 Mar 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100