title: How to save picturebox1 image to mysql database?
body: <p><strong>Here are my save button codes can anyone help my problem? thanks in advance</strong></p>
  
  <p>Private Sub btnempsave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnempsave.Click</p>
  
  <pre><code>    If rdomale.Checked = True Then
          rdo = "MALE"
      Else
          rdo = "FEMALE"
      End If
      sql = "INSERT INTO `employee_workinfo` (`emp_code`, `d_rate`, `p_method`, `position`, `w_status`, `d_hired`)" _
              &amp; " VALUES ('" &amp; txtcode.Text &amp; "','" &amp; txtdrate.Text &amp; "','" &amp; txtpmethod.Text &amp; "','" &amp; txtposition.Text _
              &amp; "','" &amp; txtworkstatus.Text &amp; "','" &amp; dtpdhired.Text &amp; "')"
      createsub(sql)
  
      sql = "INSERT INTO `employee` (`emp_code`, `emp_fname`, `emp_lname`, `emp_mname`" _
      &amp; ", `address`, `contact`, `status`, `birth_date`, `birth_place`, `emp_sex`, `emp_age`, `emerg_contct`" _
      &amp; ", `emp_tin`, `course`, `email`, `gs`, `hs`, `college`, `ar1`, `ar2`, `ct`, `nm`, `am`, `pobm`, `gsm`, `hsm`, `cm`, `dfm`, `bam`, `religionm`, `nationalitym`, `aim`, `msm`, `nf`, `af`, `pobf`, `gsf`, `hsf`, `cf`, `dff`, `baf`, `religionf`, `nationalityf`, `aif`, `msf`, `allergies`, `ail`, `pia`, `hospital`, `w_when`, `c_cause`, `l_like`, `d_dislike`, `catholic`, `prestige`, `location`, `s_sr`, `offer`, `quality`, `choice`, `pdc`, `rtp`, `rrf`, `rts`, `cd`, `bpb`, `friends`, `parents`, `relatives`, `internet`, `oo_other`, `o_other`, `entrance`, `evaluation`, `personal`, `photo`) VALUES ('" &amp; txtcode.Text &amp; "','" &amp; txtfname.Text &amp; "','" &amp; txtlname.Text _
      &amp; "','" &amp; txtmname.Text &amp; "','" &amp; txtaddress.Text &amp; "','" &amp; txtcontact.Text &amp; "','" &amp; txtstatus.Text _
      &amp; "','" &amp; dtpdbirth.Text &amp; "','" &amp; txtbplace.Text &amp; "','" &amp; rdo &amp; "','" &amp; txtage.Text &amp; "','" &amp; txtemerg.Text &amp; "','" &amp; texttin.Text _
      &amp; "','" &amp; txtcourse.Text &amp; "','" &amp; txtemail.Text _
      &amp; "','" &amp; txtgs.Text &amp; "','" &amp; txths.Text &amp; "','" &amp; txtc.Text &amp; "','" &amp; txtar1.Text &amp; "','" &amp; txtar2.Text &amp; "','" &amp; txtct.Text _
      &amp; "','" &amp; txtnm.Text &amp; "','" &amp; txtam.Text &amp; "','" &amp; txtpobm.Text &amp; "','" &amp; txtgsm.Text &amp; "','" &amp; txthsm.Text &amp; "','" &amp; txtcm.Text &amp; "','" &amp; txtdfm.Text &amp; "','" &amp; txtbam.Text &amp; "','" &amp; txtreligionm.Text &amp; "','" &amp; txtnationalitym.Text &amp; "','" &amp; txtaim.Text &amp; "','" &amp; txtmsm.Text _
      &amp; "','" &amp; txtnf.Text &amp; "','" &amp; txtaf.Text &amp; "','" &amp; txtpobf.Text &amp; "','" &amp; txtgsf.Text &amp; "','" &amp; txthsf.Text &amp; "','" &amp; txtcf.Text &amp; "','" &amp; txtdff.Text &amp; "','" &amp; txtbaf.Text &amp; "','" &amp; txtreligionf.Text &amp; "','" &amp; txtnationalityf.Text &amp; "','" &amp; txtaif.Text &amp; "','" &amp; txtmsf.Text _
      &amp; "','" &amp; txtallergies.Text &amp; "','" &amp; txtail.Text &amp; "','" &amp; txtpia.Text &amp; "','" &amp; txthospital.Text &amp; "','" &amp; txtwhen.Text &amp; "','" &amp; txtcause.Text &amp; "','" &amp; txtlike.Text &amp; "','" &amp; txtdislike.Text _
      &amp; "','" &amp; txtcatholic.Checked &amp; "','" &amp; txtprestige.Checked &amp; "','" &amp; txtlocation.Checked &amp; "','" &amp; txtsr.Checked &amp; "','" &amp; txtoffer.Checked &amp; "','" &amp; txtquality.Checked &amp; "','" &amp; txtchoice.Checked &amp; "','" &amp; txtpdc.Checked &amp; "','" &amp; txtrtp.Checked &amp; "','" &amp; txtrrf.Checked _
      &amp; "','" &amp; txtrts.Checked &amp; "','" &amp; txtcd.Checked &amp; "','" &amp; txtbpb.Checked &amp; "','" &amp; txtfriends.Checked &amp; "','" &amp; txtparents.Checked &amp; "','" &amp; txtrelatives.Checked &amp; "','" &amp; txtinternet.Checked &amp; "','" &amp; txtother2.Text &amp; "','" &amp; txtother1.Text _
      &amp; "','" &amp; TxtEntrance.Text &amp; "','" &amp; txtEvaluation.Text &amp; "','" &amp; txtPersonalE.Text &amp; "',@Photo)"
  
      cmd.Parameters.Add("@Photo", MySqlDbType.LongBlob).Value = mstream.ToArray
  
  
  
  
  
      create(sql)
      Call btnempnew_Click(sender, e)
  
  
  
      btnempsave.Enabled = True
      btnempupdate.Enabled = False
  
  
      'MsgBox(ex.Message &amp; " btnempsave_Click", MsgBoxStyle.Exclamation)
  
  End Sub
  </code></pre>