Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. How to show image from ms access to gridview

How to show image from ms access to gridview

Scheduled Pinned Locked Moved ASP.NET
databasedesignsysadminsecuritytutorial
7 Posts 4 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Pratheepa
    wrote on last edited by
    #1

    my database Ms Access has 3 fields as folllows; id- number imageName- text imageURL- text ................................................... I have a fileupload tool and a button names btnUpload which helps to upload images to a folder and that path gets saved in database field names imageURL. ......................................................... Inherits System.Web.UI.Page Dim constr As String = "Provider=Microsoft.jet.OLEDB.4.0; Data Source=D:\imgupload\db1.mdb;Persist Security Info=False;" Protected Sub btnUpload_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUpload.Click If FileUpload1.HasFile Then FileUpload1.SaveAs(IO.Path.Combine(Server.MapPath("Image"), FileUpload1.FileName)) fnSaveFile(IO.Path.GetFileName(FileUpload1.FileName), IO.Path.Combine(Server.MapPath("Image"), FileUpload1.FileName)) End If End Sub Public Sub fnSaveFile(ByVal FileName As String, ByVal FileURL As String) Dim cmd As New OleDb.OleDbCommand Dim con As New OleDb.OleDbConnection(constr) Try Dim strSql As String = "insert into tbl_Image(ImageName,ImageURL) values('" & FileName & "','" & FileURL & "')" '------------" con.Open() cmd.Connection = con cmd.CommandText = strSql cmd.ExecuteNonQuery() Catch ex As Exception Response.Write(ex.Message) Finally cmd.Dispose() con.Dispose() End Try End Sub ................................................................ my image uploading is working well. cud anyone sugesst me a way to add a gridview and show the image other than showing the path of the image.

    A M 2 Replies Last reply
    0
    • P Pratheepa

      my database Ms Access has 3 fields as folllows; id- number imageName- text imageURL- text ................................................... I have a fileupload tool and a button names btnUpload which helps to upload images to a folder and that path gets saved in database field names imageURL. ......................................................... Inherits System.Web.UI.Page Dim constr As String = "Provider=Microsoft.jet.OLEDB.4.0; Data Source=D:\imgupload\db1.mdb;Persist Security Info=False;" Protected Sub btnUpload_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUpload.Click If FileUpload1.HasFile Then FileUpload1.SaveAs(IO.Path.Combine(Server.MapPath("Image"), FileUpload1.FileName)) fnSaveFile(IO.Path.GetFileName(FileUpload1.FileName), IO.Path.Combine(Server.MapPath("Image"), FileUpload1.FileName)) End If End Sub Public Sub fnSaveFile(ByVal FileName As String, ByVal FileURL As String) Dim cmd As New OleDb.OleDbCommand Dim con As New OleDb.OleDbConnection(constr) Try Dim strSql As String = "insert into tbl_Image(ImageName,ImageURL) values('" & FileName & "','" & FileURL & "')" '------------" con.Open() cmd.Connection = con cmd.CommandText = strSql cmd.ExecuteNonQuery() Catch ex As Exception Response.Write(ex.Message) Finally cmd.Dispose() con.Dispose() End Try End Sub ................................................................ my image uploading is working well. cud anyone sugesst me a way to add a gridview and show the image other than showing the path of the image.

      A Offline
      A Offline
      Abhijit Jana
      wrote on last edited by
      #2

      Did you gone through the all the reply that was provided to you in your last post?

      cheers, Abhijit CodeProject MVP Web Site:abhijitjana.net

      P 1 Reply Last reply
      0
      • A Abhijit Jana

        Did you gone through the all the reply that was provided to you in your last post?

        cheers, Abhijit CodeProject MVP Web Site:abhijitjana.net

        P Offline
        P Offline
        Pratheepa
        wrote on last edited by
        #3

        ya but I didnt understand or get any idea to change those to my requirement. plz help me

        C A 2 Replies Last reply
        0
        • P Pratheepa

          ya but I didnt understand or get any idea to change those to my requirement. plz help me

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          Pratheepa wrote:

          ya but I didnt understand or get any idea to change those to my requirement. plz help me

          Well, posting the same question again, will get you the same answers. The problem is that you're not capable of doing this task. If this is homework, talk to your teacher. If this is paid work, tell your client that you are a fraud now, and save you and them further time and hassle. We answered you. If you can't understand it, that's not our fault.

          Christian Graus Driven to the arms of OSX by Vista. Please read this[^] if you don't like the answer I gave to your question. "! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.

          1 Reply Last reply
          0
          • P Pratheepa

            ya but I didnt understand or get any idea to change those to my requirement. plz help me

            A Offline
            A Offline
            Abhijit Jana
            wrote on last edited by
            #5

            Pratheepa wrote:

            ya but I didnt understand or get any idea to change those to my requirement.

            :(

            cheers, Abhijit CodeProject MVP Web Site:abhijitjana.net

            1 Reply Last reply
            0
            • P Pratheepa

              my database Ms Access has 3 fields as folllows; id- number imageName- text imageURL- text ................................................... I have a fileupload tool and a button names btnUpload which helps to upload images to a folder and that path gets saved in database field names imageURL. ......................................................... Inherits System.Web.UI.Page Dim constr As String = "Provider=Microsoft.jet.OLEDB.4.0; Data Source=D:\imgupload\db1.mdb;Persist Security Info=False;" Protected Sub btnUpload_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUpload.Click If FileUpload1.HasFile Then FileUpload1.SaveAs(IO.Path.Combine(Server.MapPath("Image"), FileUpload1.FileName)) fnSaveFile(IO.Path.GetFileName(FileUpload1.FileName), IO.Path.Combine(Server.MapPath("Image"), FileUpload1.FileName)) End If End Sub Public Sub fnSaveFile(ByVal FileName As String, ByVal FileURL As String) Dim cmd As New OleDb.OleDbCommand Dim con As New OleDb.OleDbConnection(constr) Try Dim strSql As String = "insert into tbl_Image(ImageName,ImageURL) values('" & FileName & "','" & FileURL & "')" '------------" con.Open() cmd.Connection = con cmd.CommandText = strSql cmd.ExecuteNonQuery() Catch ex As Exception Response.Write(ex.Message) Finally cmd.Dispose() con.Dispose() End Try End Sub ................................................................ my image uploading is working well. cud anyone sugesst me a way to add a gridview and show the image other than showing the path of the image.

              M Offline
              M Offline
              Matt Cavanagh
              wrote on last edited by
              #6

              If im understanding right then just put this in ur gridview on ur aspx page: <img src='<%# DataBinder.Eval(Container.DataItem, "imageURL") %>' alt='<%# DataBinder.Eval(Container.DataItem, "imageURL") %>' />

              P 1 Reply Last reply
              0
              • M Matt Cavanagh

                If im understanding right then just put this in ur gridview on ur aspx page: <img src='<%# DataBinder.Eval(Container.DataItem, "imageURL") %>' alt='<%# DataBinder.Eval(Container.DataItem, "imageURL") %>' />

                P Offline
                P Offline
                Pratheepa
                wrote on last edited by
                #7

                thanks a lot. it really works.

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups