Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

Ok (deep breath)...

 

I'm using this Software called "Card Five" to print credit-card like cards. It uses an access database to retrieve information, name and a photo.

 

I made an application to add automatically all photos to the access database (the fotos have the same name as the persons ID). My program works great and already have added all photos to the dabase. Unfortunately, when I use Card-Five program to get the images from the access database the program shows nothing in the preview box (a 50x50 label which normally would show the photo).

 

When I manually add a picture using Card-Five (browing the folders and selecting a picture file) it works great. The minute I use my proggie to add the pictures Card-Five simply refuses the show me anything. The only thing it shows is a white image with some black text saying: "Picture Format".

 

I've checked the type of data stored in the access database from both Card-Five and my application and they are defined as "Long-Binary-Format" in a OLE Object type field.

 

This is the code I'm using to insert the images on the database:

MemoryStream ms = new MemoryStream();
bmpFile.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);

string sSQLQuery = "UPDATE " + this.txt_tableName.Text + " SET " + this.cbx_imagesField.Text +
   " = (?)";

OleDbCommand cmd = new OleDbCommand(sSQLQuery, cCon);
try
{
   byte[] binContent = ms.ToArray();

   OleDbParameter imageParameter = cmd.Parameters.Add("@Picture", OleDbType.Binary);
   imageParameter.Value = binContent;
   imageParameter.Size = binContent.Length;

   sSQLQuery += " WHERE " + this.cbx_IDField.Text + " = " + sFileName;

   //MessageBox.Show(cmd.CommandText);
   cmd.CommandText = sSQLQuery;
   cmd.ExecuteNonQuery();
}

catch (Exception ex)
{
   MessageBox.Show(ex.Message);
}
cmd.Dispose();

 

Does anyone have a clue of what is happening? Is there any other way to add images to the Access data base? Is there any special Parameter I can supply with to walk around or at least to try to walk around the problem?

 

Thank you so very much if you really have a suggestion.

Edited by EFileTahi-A
  • Administrators
Posted

If you try and read out one of the entries added by their software can you display it in a picturebox?

 

They might not be storing the raw image bytes but doing some additional things to it first, if that's the case then you would need to duplicate the changes - you could add an image via your program and then save the raw bytes out, add the same one via theirs and then save the raw bytes out and compare the results.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted

Thank you both for the posts. Plausibly, I got an extra work at the momment which will consume my time for a week or 2. Whenever I got the oportunity to try what you suggested I'll post about it.

 

Thank you once more!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...