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. General Programming
  3. Visual Basic
  4. how to insert image into sql database table

how to insert image into sql database table

Scheduled Pinned Locked Moved Visual Basic
databasegraphicshelptutorial
4 Posts 3 Posters 0 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.
  • V Offline
    V Offline
    vrk_raju
    wrote on last edited by
    #1

    how to insert the pic into the database table.. str_insert = "INSERT INTO SIS_TeachingStaff VALUES('TSMT2','V.RAJANIKANTH','LECTURER','TEACHING STAFF','Msc(Maths)','" & Emp_pic.Image & " '" '" & CByte(Me.opendialogbox.FileName.Length) & "' " cmd = New SqlCommand(str_insert, conn) cmd.Connection = conn cmd.ExecuteNonQuery() error is:operator '&' is not defined for types 'string' and 'system.drawing.image'

    A S 2 Replies Last reply
    0
    • V vrk_raju

      how to insert the pic into the database table.. str_insert = "INSERT INTO SIS_TeachingStaff VALUES('TSMT2','V.RAJANIKANTH','LECTURER','TEACHING STAFF','Msc(Maths)','" & Emp_pic.Image & " '" '" & CByte(Me.opendialogbox.FileName.Length) & "' " cmd = New SqlCommand(str_insert, conn) cmd.Connection = conn cmd.ExecuteNonQuery() error is:operator '&' is not defined for types 'string' and 'system.drawing.image'

      A Offline
      A Offline
      adairjk
      wrote on last edited by
      #2

      The error appears to be generated by a problem with the quotes between ...Image and CByte...

      1 Reply Last reply
      0
      • V vrk_raju

        how to insert the pic into the database table.. str_insert = "INSERT INTO SIS_TeachingStaff VALUES('TSMT2','V.RAJANIKANTH','LECTURER','TEACHING STAFF','Msc(Maths)','" & Emp_pic.Image & " '" '" & CByte(Me.opendialogbox.FileName.Length) & "' " cmd = New SqlCommand(str_insert, conn) cmd.Connection = conn cmd.ExecuteNonQuery() error is:operator '&' is not defined for types 'string' and 'system.drawing.image'

        S Offline
        S Offline
        shreekar
        wrote on last edited by
        #3

        As pointed out, the error is because you are trying to concat a string and an image. What you need to do is convert the image into byte array and insert it into the database field. If you google for that, you should be OK.

        Shreekar http://shreekarishere.blogspot.com

        V 1 Reply Last reply
        0
        • S shreekar

          As pointed out, the error is because you are trying to concat a string and an image. What you need to do is convert the image into byte array and insert it into the database field. If you google for that, you should be OK.

          Shreekar http://shreekarishere.blogspot.com

          V Offline
          V Offline
          vrk_raju
          wrote on last edited by
          #4

          sreekar please give code for converting the image into array byte...pl urgent.

          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