Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB6 Oracle
Hello,
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 22:31pm
surkhi623

1 solution

Rate this: bad
good
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
  Permalink  
Comments
cool_sari at 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 at 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 at 16-Mar-13 5:21am
   
ok.....
so I don't need to use removeitem property of combo box.
thanx
Sandeep Mewara at 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 at 16-Mar-13 5:29am
   
ya i'll re-fetch that data in future
thanx

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

  Print Answers RSS
0 Marcin Kozub 275
1 OriginalGriff 264
2 Sergey Alexandrovich Kryukov 215
3 Praneet Nadkar 197
4 Richard MacCutchan 182
0 OriginalGriff 8,048
1 Sergey Alexandrovich Kryukov 7,287
2 DamithSL 5,614
3 Manas Bhardwaj 4,986
4 Maciej Los 4,910


Advertise | Privacy | Mobile
Web01 | 2.8.1411023.1 | Last Updated 16 Mar 2013
Copyright © CodeProject, 1999-2014
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