ahmed salah

ahmed salah

  • NA
  • 85
  • 58.6k

image not store in access 2017 database based on UserID

Mar 8 2017 8:10 AM

Problem

update image based on UserID not saved in database access 2007

I need to update field qrimg in access 2007 database

Based on field UserID with datatype text

AllPrinting table have two fields UserID,qrimg

and qrimg with datatype OleObject

my code with c# windows form application c# vs 2015

under button i write

  1. byte[] buffer = File.ReadAllBytes(path);  
  2.  OleDbConnection oleDbConnection = new OleDbConnection(connection);  
  3.  string str = "Update AllPrinting set  qrimg=@qrimg where UserID=@UserID"; OleDbCommand oleDbCommand = new OleDbCommand();             oleDbConnection.Open();        
  4. oleDbCommand.Connection = oleDbConnection;             oleDbCommand.CommandText = str;             oleDbCommand.Parameters.AddWithValue("@UserID", label4.Text);  
  5. byte[] yourPhoto = buffer;             oleDbCommand.Parameters.AddWithValue("@qrimg", yourPhoto);    
  6.  using (oleDbConnection)   
  7. {           
  8.  oleDbCommand.ExecuteNonQuery();   
  9. }      
  10. oleDbConnection.Close();  
 

when press button to execute code above not exception show

and also no update to image in access done

so that what is the problem

when i press button i add two message box to path and label4 and all both have values


Answers (1)