Click here to Skip to main content
14,207,956 members
Rate this:
 
Please Sign up or sign in to vote.
i have a datagridview named datagridview1 . i want to select multiple images from any folder and put the inside my datagridview.

i have successfully added then inside my datgridview1 .but the problem is how could i save those images into my sqlserver database .
can any one help me

What I have tried:

private void barBtnOpen_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
{
try
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "JPG|*.jpg|JPEG|*.jpeg|PNG|*.png|Tif|*.tif";
ofd.Multiselect = true;
ofd.ShowDialog();
string[] files = ofd.FileNames;

foreach(string filename in files)
{

Image image = Image.FromFile(filename);
DataGridViewImageColumn img = new DataGridViewImageColumn();
img.HeaderText = "ImageSelect";
img.Name = "PhotoImage";
datagridview1.Rows.Add(image);
}


}
catch
{
return;
}
}
Posted
Updated 24-Feb-19 21:52pm
v2
Comments
Richard MacCutchan 22-Feb-19 10:02am
   
Please edit your question, format your code properly, and explain what the problem is.
Gerry Schmitz 22-Feb-19 10:12am
   
You have to "template" the column to accept an image.

Just moving "something" into a column and expecting it to "display" is beyond its understanding.

1 solution

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

Solution 1

   

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



Advertise | Privacy | Cookies | Terms of Service
Web04 | 2.8.190612.1 | Last Updated 25 Feb 2019
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

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