YOUn'Me
YOUn'Me

Reputation: 107

Cannot retrieve picture from Ms Access to picture box

cn.Open(); 
OleDbDataAdapter da = new OleDbDataAdapter("select Photo Account WHERE UserName like Purchasedby", cn); 
DataSet ds = new DataSet(); 
da.Fill(ds); 
cn.Close(); 
byte[] content = (byte[])ds.Tables[0].Rows[0].ItemArray[0]; 
MemoryStream stream = new MemoryStream(content); 
pictureBox1.Image = Image.FromStream(stream);

it says that the Parameter is not valid>> how should I do this??

Upvotes: 1

Views: 205

Answers (1)

Dilshod
Dilshod

Reputation: 3311

Please fix your SQL first. It should look something like this: select Photo, Account WHERE UserName like '%Purchasedby%'. If you still get error then provide the exception message and call stack if possible.

Upvotes: 2

Related Questions