Image lost in update on database, help needed!

davearia

Well-known member
Joined
Jan 4, 2005
Messages
184
Hi All,

I have wrote this database desktop application (using SQL Server 2000), that stores jigsawpuzzle details into a database. 95% of it works perfectly but I have one or two bugs that I am really keen to weed out but I am not too sure of how to do this.

I have zipped up my code as it is too large to paste in here. I scanned it for viruses before I uploaded it and it is clean.

I will try to explain the main problem as best I can.

When the application fires up it fills a dataset and the contents of the dataset populates the main form, so you have the title of the jigsaw, how many pieces, price etc in the form along with a picture of the jigsaw stored in a picturebox. This works fine.

The user can add new jigsaws by pressing the create new record button. Whether or not they supply a picture the insert works fine as there is a default picture to use just in case. This works fine.

The user can delete any record. This works fine.

This were things go a little wrong. If say for example the user wants to alter the title of the jigsaw but leave everything else as it was (including the picture) and press the update button. The update fails,complaining that there was no picture supplied in the update. If I did exactly the same as before but this time double click on the picture box and locate in the dialog box the picture already populating the picturebox, the update works fine.

If I have confused you, I am sorry. Basically the dataset fills all the form including the picturebox, however when I try to update the record, the image in the picturebox seems to get lost somehow, unless I reload from the dialog box.

I hope this makes sense, if it does please help me if you know what is going on.

I have added a screenshot of the dubugger running whilst the above mentioned error occured to the zip file, it might be helpful.

Thanks, Dave. :D
 

Attachments

P.S. I think my problem lies with the System.Runtime.InteropServices.ExternalException if this helps
 
It seems that closing a memory stream explictly i.e. ms.Close() loses the image. I took all instances of, ms.Close(), and its fine.
 
Back
Top