i am building a site, that includes the user submitting comments. Now, want to save the different comments.. i read a bit about Linq to SQL and ADO.. they all talk about storing small bits of information like names, emails, passwords etc. But whats the most efficient way to save messages (which will be incorporated to a page like in youtube) at the end?
I think comments on a webpage still count as "small bits". Just make sure your database field has enough space (nvarchar(MAX)
if supported, otherwise text
or ntext
, depending on your database of choice)
I don't think you need to start considering other methods of accessing data unless you have dozens of kilobytes of data per object, or a very large number of objects per page.
Exactly the same way. You also want to html encode your message before you insert it into a database to avoid unwanted sql injections. Linq doesn't have such problems since it uses parameters to insert your text.
You should prefer paramater based insertion of text over embeded sql + encoding.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With