error saving image into mysql database.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • WellCom34
    New Member
    • Aug 2009
    • 1

    #1

    error saving image into mysql database.

    hey guys need a little help.
    i tried to save image into my database, it saves without error
    but when i tried to check if it saves in mysql, the data about my picture id save, but the image i save return a value of 0.
    please help me with this.

    here's my code...
    -------------------------------------------------------------------------------------
    Code:
    myconn = New MySqlConnection(cons)
    mycom = New MySqlCommand
    Try
    mycom = New MySqlCommand("insert into tblpic values('" & PicID.Text & "','" & PictureBox1.Dock & "')", myconn)
    myconn.Open()
    mycom.ExecuteNonQuery()
    myconn.Close()
    MsgBox("Record SAVED")
    
    Catch ex As Exception
    MessageBox.Show(ex.Message, "Database Failure!", MessageBoxButtons.OK, MessageBoxIcon.Error)
    End Try
    ------------------------------------------------------------------------------------

    thanks in advance.(",)
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    TIP: When you are writing your question, there is a button on the tool bar that wraps the [code] tags around your copy/pasted code. It helps a bunch. Its the button with a '#' on it. More on tags. They're cool. Check'em out.

    Comment

    • AnagJohari
      New Member
      • May 2010
      • 96

      #3
      Originally posted by WellCom34
      hey guys need a little help.
      i tried to save image into my database, it saves without error
      but when i tried to check if it saves in mysql, the data about my picture id save, but the image i save return a value of 0.
      please help me with this.

      here's my code...
      -------------------------------------------------------------------------------------
      Code:
      myconn = New MySqlConnection(cons)
      mycom = New MySqlCommand
      Try
      mycom = New MySqlCommand("insert into tblpic values('" & PicID.Text & "','" & PictureBox1.Dock & "')", myconn)
      myconn.Open()
      mycom.ExecuteNonQuery()
      myconn.Close()
      MsgBox("Record SAVED")
      
      Catch ex As Exception
      MessageBox.Show(ex.Message, "Database Failure!", MessageBoxButtons.OK, MessageBoxIcon.Error)
      End Try
      ------------------------------------------------------------------------------------

      thanks in advance.(",)
      you save your images in bit form or string form,
      if you are useing string then its very simple,
      but if you are using bit form method then its tough
      so first tell which method you use to save an image

      Comment

      Working...