Last post Sep 14, 2014 09:51 AM by Rion Williams
Sep 14, 2014 09:34 AM|gigidel|LINK
I create Rich text Box by using Tiny_MCE I saved info inside sql by linq and now I want to retrieve saved info in That Rich Text Box
how to do that?
Plz help me Thanks.
Sep 14, 2014 09:51 AM|Rion Williams|LINK
Assuming you used
the steps mentioned in this previous post to save the HTML contents of your TextBox into a SQL database, you can essentially do the opposite to pull the content that you need and display it :
// Build your connection
using(SqlConnection yourConnection = new SqlConnection("Your Database Connection String"))
// Build your query (to retrieve your HTML data)
var query = "SELECT TOP 1 YourHTMLColumn FROM YourTable";
// Open your connection
// Build a command to execute
using(var yourCommand = new SqlCommand(query, yourConnection))
// Execute your query
string html = Convert.ToString(yourCommand.ExecuteScalar());
// Store your HTML contents in your RichTextBox
YourRichTextBox.Text = html;
This is obviously just a very simplified example, but the basic logic is there.