Click here to Skip to main content
15,883,883 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
My application has to fetch database from SQL Server 2008 and export it to CSV or XML and than use that exported one as database for the application and display the details corresponding to any id. All working fine but when saved in sql db image datatype saves images in <Binary data> which is saved in csv as string, so how to display that image in pictureBox. Actually the another app is for windows CE compatible device which can only support CSV or XML or any of same kind.
My data fields are integer, string and image.
Posted
Updated 25-Oct-14 2:09am
v2

For image you have to do differently.

1. Fetch Data from SQL
2. Get the Image as binary , prepare image & store in a folder
3. Write folder path to CSV
 
Share this answer
 
Comments
kool15th 14-Oct-14 8:35am    
Any other option ? as fetching SQL DB and creating CSV or XML is from desktop app but the accessing CSV/XML as DB has to done from handheld device. Thus I have to separately copy images folder also along with it.
Hello

For image you have to do differently.

1. Fetch Data from SQL
2. Get the Image as binary and convert binary data to Base64String.
3. Create XML or CSV file.


When want to display the image the convert Base64String to byte data and display as image.
 
Share this answer
 
Comments
kool15th 25-Oct-14 8:06am    
DataRow[] row1 = dsDB.Tables[0].Select("PersonnelNo='" +" ab "+ "'");
txtVehicleNo.Text = row1[0][1].ToString();
picBoxOwner.Image = Image.FromStream(new MemoryStream((Byte[])row1[0][2]));


Its working fine in vs 2010 but in vs 2008 for windows CE Device Image.FromStream does not support.
What to do ? please suggest something...

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