none
Saving Bitmap File To MS Access 2003 Problem RRS feed

  • Question

  • Hi,

     

    Problem:

         I'm using C# 2005 and MS Access 2003. The data type of the bitmap file saved to database is "long binary data". It should be "OLE Object".

     

    Source Code:

    Code Snippet

    Bitmap myBitmap = new Bitmap(@"c:\Picture1.bmp");

    OleDbConnection conn = new OleDbConnection("<<My Connection String>>");

    conn.Open();

    string sql = "UPDATE Table1 SET fldOLE = @fldOLE WHERE fldID = 5";

    OleDbCommand command = new OleDbCommand(sql, conn);

    command.Parameters.Add(new OleDbParameter("@fldOLE", myBitmap));

    int rowsAffected = command.ExecuteNonQuery();

     

     

    Question:

         How can I save Bitmap to database with data type "OLE Object"?

    Monday, March 17, 2008 6:20 PM

Answers

All replies