Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
how to insert image in datagridview in byte form that can be store in database
Posted
Comments
gggustafson 30-May-14 12:46pm    
You use the DataGridView Image property to add an image. The image that you insert is of type System.Drawing.Image not byte[]. If you want to store that image in a database, use the database's SQL to do so.
What have you tried?
ZurdoDev 30-May-14 14:59pm    
By writing code. Where are you stuck?

1 solution

Store the image in a Blob field in the database.

- Declare a Field of type varbinary(max) in the database (if it is sql server).

1) Declare an object of type Image and load the picture file into that Object.
2) Take that Object and store it in the database.

Here are some links:

Storing and Retrieving Images from SQL Server using Microsoft .NET[^]


and


http://support.microsoft.com/kb/316887/en-us[^]

and


http://www.dotnetgallery.com/kb/resource21-How-to-store-and-retrieve-images-from-SQL-server-database-using-aspnet.aspx[^]
 
Share this answer
 
v2

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