Click here to Skip to main content
16,022,296 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am working on a personal C# website, and I have an about section that I would like to perform read, write and update operations on. However, I do NOT want to pollute the database with multiple rows of different about blurbs that I added previously. What are some good ways in going about implementing something like this?

What I have tried:

I would assume that it would just be a single row in the DB that just gets changed without anymore rows proceeding it, but like I said, I am curious about other better options in approaching a problem like this.
Posted
Comments
Richard Deeming 10-Jul-24 11:04am    
Would a static HTML file stored in the server's file-system work? Assuming you can get write access to a folder somewhere in your site...
Baraiboapex 10-Jul-24 11:35am    
Hmmm, I would be worried about security then for things like XSS, although I could just scrub the HTML with regex replacements and stringify or escape the dangerous characters in the text input. (I would be the only one to have access to this website to be honest, but practicing good security is always good ;) ) Perhaps a text file or something would be best? I also thought about this, but was just wondering if there was probably a better way to doing it. However, if there is not, then I guess the text file would work. Thanks for the tip!
Richard Deeming 11-Jul-24 4:38am    
If you're worried about someone editing the details to insert malicious scripts, then that concern would apply whether you stored the data in a file on disk or in the database. :)
PIEBALDconsult 10-Jul-24 22:47pm    
More detail is required.

1 solution

It sounds like you are talking about keeping an archive of old entries. One way to accomplish this would be to use a database trigger tied to an update that saved a copy of the record you have just changed into an archive table. With that approach, your master table would only need to have one row, and the history of the record could be maintained in the old archive table. Add in details about when the change occurred and you have a complete audit trail of changes, along with the ability to rollback changes if you needed to.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900