如何使用C#在SQL Server中存储段落 [英] how to store a paragraph in sql server using c#

查看:144
本文介绍了如何使用C#在SQL Server中存储段落的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在使用sql server 2000和c#2005,我想使用c#表单存储和检索数据.我的数据以文本形式包含两个以上的段落,并且具有不同的字体.如何将这些数据存储在服务器中?哪种数据类型最适合此目的?请通过提供我必须遵循的所有必要步骤来帮助我.


I am using sql server 2000 and c# 2005, i wanna to store and retrieve a data using c# forms. my data is more than two paragraph in a text form and having different fonts. how can i store this data in my server? and what kind of data type is best for this purpose? please help me by giving all the necessary steps that i must follow.

thank U for U''r help.

推荐答案

假设您正在使用RichTextBox es,则可以存储RichTextBox的Rtf属性.这包括与文本关联的所有样式信息.请参见此处 [此处 [
Assuming that you are using RichTextBoxes, you can store the Rtf property of the RichTextBox. This includes all of the styling information associated with the text. See here[^] for some documentation on RTF.

As far as what data type to use, I would suggest the text data type. See here[^] for a listing of the various data types. Text will give you up to 2,147,483,648 characters.


zerishlove写道:
zerishlove wrote:

文本形式且具有不同字体

text form and having different fonts


当您说这句话时,则意味着您要保存html类内容,以使表单样式有效,并且可以在检索后显示时使用.

以下是分步指南,将整个网页原样保存在数据库中,并在需要时进行检索:


When you say this, then it means you want to save the html sort of content such that the form styles are entact and can be used while showing after retrival.

Here is a step-by-step article that saves the whole webpage as-is in the database and retrieves it when needed: Saving and Retrieving Web Page Control with SQL Server and C#[^]
:thumbsup:


这篇关于如何使用C#在SQL Server中存储段落的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆