I have a finance program that records transactions coming in from one or multiple budgets, for example I can create one or more budgets(Account), add and spend money from whichever I choose from a combo box, I then have a list box that is populated by the transactions I have done(kinda like bank statements), whenever there’s a transaction, a object of type

Transaction is added to a Transaction Type list which is then serialised using JSON and added to my database, I then when need to populate the List box deserialize all the JSON strings in the database table with the corresponding budget ID when print the .ToString() onto each line, The problem I want a delete button for the listbox that deletes the selected item, I know |I have to compensate the budget balance for the amount deleted but I dont know how to delete the JSON string correspondent to that Object off of the database Table transactions, I know I have to probably use the TransactionID column but I don’t know how to access it after it’s in the list box and in ToString form. Please help I kinda new to programming. Thank you xD
SQL TABLES
A way to solve both issues, not losing the transactions and not showing the transaction, is to just make the selected / deleted transaction invisible.
This can be done by adding a flag to your items in the database and then only display items that have not been “deleted”. The flag will get switched when the user clicks on the hide button associated to the current transaction.
I think deleting in general would not be the approach I would take.
ohh okay so it won’t actually be deleted but only flagged as deleted so when populating the list box I wont show transactions that are flagged okay that makes sense thank you so much I will try this approach and let you know how I get along.
I wouldn’t recommend storing JSON in a regular RDBMS.
C# devs
null reference exceptions

source