Problems reading text and ntext Type field contents in SQL database

Source: Internet
Author: User
Tags byte sizes

Always encounter problems with text type and ntext type fields that can't be read.

Today, after a long day, and then looked at the data, and finally the problem was taken care of

First we should know what the difference is between the two types of fields:

Although it looks like they are called text, but he is not used to save the text, is actually used to save the file, and the image type, generally used to save the MIME type of data.

And I used it to keep the main content of the news, so I can save more. The result is always unreadable ...

I use an ADO connection, when reading data, because accustomed to the previous ASP's writing, with Conn.execute () to read,,, this read to save the MIME type of the field is invalid,,,

So change to Rs.Open method to read the good ....

Remember this, to do the study.

So what is the difference between the two methods of execution in nature? What is the difference in dealing with MIME types?

Personally think that the Conn.execute () method to get the MIME type in RS should only get an index, and in the Way of Rs.Open () should be the MIME type of content it!

A comparison of the byte sizes of Rs obtained in both ways should indicate the result.

When applied, use Conn.execute () when listing only indexes, headings, and so on. When you want to display the full content with Rs.Open (), I think this can improve a lot of performance!


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.