Click here to Skip to main content
14,238,693 members
Rate this:
Please Sign up or sign in to vote.
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

Rate this:
Please Sign up or sign in to vote.

Solution 1

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[^]
   
v2

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




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100