Data Browser - Viewing Site  Sector 23 Code Bank Logged in as:  Guest  


Insert Image to PDA database
Inserting an image (or any byte[]) to a Sql Server Database in .NET is easy. Create a parameter of type Image, set the value to the byte[], and add it to the command.
So, when I tried to do this on the Compact Framework, who would have thought it would take three hours on google to duplicate this functionality!??

Oh the insanity!

After sleeping on it overnight, and resuming the search in the morning, I finally stumbled on what must apparently be obvious to everyone else.
In the sql CommandText, instead of writing "insert into image_table (image_field) values (@myParameterName)", I changed it to "insert into image_table (image_field) values (?)",
and left everything else (including naming my parameter "@myParameterName") the same.
And it worked. Why the syntax suddenly changed, don't ask me.

Created By: amos 3/20/2006 12:13:00 AM
Updated: 8/13/2021 6:25:06 AM