Asp.net updates blob

Source: Internet
Author: User

The example used in this article is based on the Microsoft Enterprise Library

When you insert a database, DB. addinparameter (dbcommand, "aimg", dbtype. Binary, model. aimg) is used );

DB. addinparameter (dbcommand, "aimg", dbtype. Binary, model. aimg) was used for the first update. The result failed.

Each second update uses a self-written method:

/// <Summary>
/// When storing BLOB, the content is stored in oracleparameter. if the content is empty, varchar2 is used. Default direction input.
/// </Summary>
/// <Param name = "orakey"> Field </param>
/// <Param name = "value"> value </param>
/// <Returns> </returns>
Public static idataparameter createblobparameter (string orakey, byte [] value)
{
Oracleparameter Param = NULL;
Param = new oracleparameter (orakey, oracletype. Blob );
If (value! = NULL & value. length> 0)
{
Param. value = value;
}
Else
{
Param. value = dbnull. value;
}
Param. Direction = parameterdirection. input;
Return Param;
}

The result still failed.

Later, I added a statement (statement A) to update myimagetab set aimg = empty_blob () Where id = 1, and then executed the update statement. The result was successful.

I may be confused later. I deleted this statement a, and the subsequent update was successful.

Possible cause: the original image is too large and cannot be updated for different types.

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: info-contact@alibabacloud.com 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.