Home > DeveloperSection > Blogs > i want to display images into to datagridview one by one taking image url from database field

i want to display images into to datagridview one by one taking image url from database field


ASP.Net ASP.Net 
Ratings:
3 Comment(s)
 5985  View(s)
Rate this:
Dim di As New IO.DirectoryInfo("C:\Inetpub\wwwroot\images")
Dim aryFi As IO.FileInfo() = di.GetFiles("*.JPG")
For Each fi In aryFi
Dim imagname As String = fi.Name
Dim path As String = "http:\\192.168.52.36\images\" & fi.Name
Try
con.Open()
Dim sqlquery As String = "insert into tbl_images values('" & imagname & "','" & path & "')"
Dim sqlcommand As New SqlCommand(sqlquery, con)
sqlcommand.ExecuteNonQuery()
con.Close()
Catch ex As Exception
MsgBox(ex.ToString)
End Try
Next
by this way i am saving images path in database....... like http:\\192.168.52.36\images\img1.jpg.. now i want to display the images in to a control like datagridview taking the images path from database... this is window based appplication..... plz any idea to go forward.. help me out.....

thanks
priya...

Image in DataGridView

By James Smith on   5 years ago

Hi Priya,

First thing, This is not the perfact place to ask a question or discussing any topic. Here you can submit only blogs. If you want to ask any question then Please join mindstick forum at follwoing link

http://www.mindstick.com/mindForum/Topic.aspx

From Here you can put appropriate type and then ask your question or you can start new topic or discussion.

Answer of your question

Here I am writing few steps which might be helpful for you while solving your problem.

>>Create a SqlConnection object.

>>Create a SqlDataAdapter object.

>>Create a DataSet object.

>>Fill records of table into DataSet.

Now by doing these steps all the info comes in your dataset. Now you can easily bind information in DataGridView by making some changes.

>>Make column of DataGridView of type Image in which you want to show image.

>>Bind info of DataSet in DataGridView.

You can take following link for help.

http://msdn.microsoft.com/en-us/library/bxt3k60s.aspx

http://msdn.microsoft.com/en-us/library/2ab8kd75.aspx#Y195

Thanks.


Image in DataGridView

By James Smith on   5 years ago

Hi Priya,

This is not the perfact place to ask a question or discussing any topic. Here you can submit only blogs. If you want to ask any question then Please join mindstick forum at follwoing link

http://www.mindstick.com/mindForum/Topic.aspx


Image in DataGridView

By Arun Singh on   4 years ago
Thanks James,
The above link is useful for me.

Don't want to miss updates? Please click the below button!

Follow MindStick