Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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.
[no name] 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

 
Share this answer
 

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