-4

如何将格式化文本从富文本框中保存和检索到 SQL 数据库中?

4

2 回答 2

0

I solved it myself and want to share with you..Thanks

You can use RichTextBox1.rtf.

Insert Into Table1(Note)Values('" + RichTextBox1.rtf + "')

This will insert as formatted text. You can retreive the text with same format you edited in the UI.

Thanks all for you feedback..

于 2012-04-11T05:29:41.250 回答
0

你可以这样做

 string queryString = 
        "INSERT INTO Users (Description) VALUES('" + RichTextBox1.Text + "')";
    using (SqlConnection connection = new SqlConnection(
               connectionString))
    {
        SqlCommand command = new SqlCommand(queryString, connection);
        connection.Open();

        try
        {
            command.ExecuteNonQuery();
        }
        Catch
        {

        }
        finally
        {

        }
    }
于 2012-04-10T12:11:02.807 回答