inserting photo in db!

Results 1 to 2 of 2

Thread: inserting photo in db!

  1. #1
    Join Date
    Dec 1969

    Default inserting photo in db!

    I am using visual basic as a front end and sql server as a Back end.<BR>Inserting and viewing photo for the employee using common dialog control and picture box.I have written coding for it.<BR>My problem is<BR>1.Not able to see the photo while inserting but(the path of the photo alone is storing in the database).<BR>2.In viewing the picture, <BR>i)if i click one picture for the employee no.1 <BR>I can able to view his picture.<BR>ii)if i select next picture for the employee no.2 (path for the second photo is stored)<BR>First picture is not clearing.Not able to view the second photo.<BR>Kindly suggest.<BR><BR>Private Sub cmdsave_Click()<BR>Dim photopath As String<BR>MsgBox "insert a photo"<BR>CommonDialog1.ShowOpen<BR>photopath = CommonDialog1.FileName<BR>If photopath = " " Then<BR>MsgBox "Do have a photo to insert?", vbYesNo<BR>If Button = vbYes Then<BR>CommonDialog1.ShowOpen<BR>photopath = CommonDialog1.FileName<BR>MsgBox (photopath)<BR>End If<BR>End If<BR>If photopath &#060;&#062; " " Then<BR>rs.Fields("chrphoto") = photopath<BR>End If<BR>If photopath = " " Then<BR>rs.Fields("chrphoto") = " "<BR>End If<BR>End sub<BR><BR>Private Sub cmdview_Click()<BR>Dim sr As String<BR>If rs.Fields("chrphoto") = " " Then<BR>Picture1.Picture = LoadPicture(" ")<BR>labelpic.Visible = True<BR>labelpic.Caption = "No Photo Available"<BR>End If<BR>If rs.Fields("chrphoto") &#060;&#062; " " Then<BR>sr = rs.Fields("chrphoto")<BR>Picture1.Picture = LoadPicture(sr)<BR>labelpic.Visible = False<BR>End If<BR>End sub<BR><BR><BR><BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: inserting photo in db!

    Where are you requerying the DB?<BR>and you don&#039;t call the display sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts