Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi All,
I am developing an application and i want to store images in database, I am using SQL Compact Edition 4.0 as database.

I have a table in database named property_images where there is a Primary key which is nvarchar and 4 images column that is image (datatype).

The problem that i am facing when i retrieve images fro database on my vb .net form database with sql query i receive all four image similar. If i stored four different image in four different column then also i get four similar images on retrieval via sql query. I doubt that there is some issue with my insert query.

I am using parametrized query to insert data in database.
Posted
Updated 2-Mar-15 15:10pm
v2
Comments
barneyman 2-Mar-15 23:06pm    
i don't know the specific solution to your problem, but i do know that blob handling in the SQL client is normally limited to one per returned rowset (NOT one per row), so you'd have to do 4 discrete inserts and 4 selects

i'd also check your columns do have 4 different pics in them - use DATALENGTH to find out how long they are, and put 4 different sized pictures in

(source http://www.codeproject.com/Articles/7590/Managing-Blobs-Using-the-ATL-OLE-DB-Consumer-Templ )
Kashif Alvi 3-Mar-15 23:29pm    
Yes! i can do that.
I can use different select queries to get images from database.
but the problem here is that i cannot use different insert queries as i am using parametrized query and if there are less parameters than the columns then it returns an error. my database structure is <tablename> property_images <column1> pmid nvarchar <column2> image <column3> image2 image <column4> image3 image <column5> image4 image;

Please help.

And thank you.
barneyman 4-Mar-15 23:19pm    
so have your insert accepts NULLs and do it 4 times
value,null,null,null
null,value,null,null
null,null,value,null
null,null,null,value

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900