Wade wrote:
I have created a shopping cart asp.net application using SQL Server 2000 as the database. In my products table, I have a column called ProductSalesHTMLText that I want the ability to store, retrieve, and assign to a label control on a ProductDetails.aspx page. How do I go about storing HTML formatted text into a SQL 2000 table and retrieve it for dynamic display on the product details page? What data type should I use? What is the best way to get the data copied and pasted into the data column in the table?
Thanks,
Wade
Wade,
Are you sure there is an advantage in storing HTML in the database?
Normally you want to separate "data" from "presentation" and hence you would only use the database to store information about the products. ASP.NET is designed to do the rendering for you and hence is the best place to have prsentation logic. You can also cache HTML fragments at the web server if you are trying to improve performance by using a UserControl and setting its cache settings appropriately.
If you must store HTML in the database, then SQL Server 2005 allows you to store native XML in the db which would obviously be an advantage to you... otherwise you should use an text or nText field since it gives you an unlimited size.