store image into access database error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • arun12in
    New Member
    • Jan 2014
    • 1

    store image into access database error

    Code:
    Private Sub CMDPHOTO_Click()
    With Cdlg
        .FileName = ""
        .Filter = "Image (*.jpg)|*.jpg"
        .ShowOpen
        If Len(.FileName) <> 0 Then
            FN = .FileTitle
            pathpic = .FileName
            Image1.Picture = LoadPicture(.FileName)
        End If
    End With
    End Sub
    
    
    
    Private Sub cmdsave_Click()
    Dim dt As String
    Dim errflag As Boolean
    Select Case toggle
    Case 0:
    dt = ""
    dt = DTPicker1.Value
     Set mstream = New ADODB.Stream
            mstream.Type = adTypeBinary
            mstream.Open
            If pathpic <> "" Then
               mstream.LoadFromFile pathpic
            End If
    ssql = "insert into Customer_table(customer_name,address,Phone_No1,Phone_No2,Email1,Email2,Profile,Docs,Reg_Date,Remarks,Pic,Pic_Name) values ('" & txtcustomername.Text & _
    "', '" & txtaddress.Text & "','" & txtPhoneno1.Text & "','" & txtPhoneno2.Text & "','" & txtEmailid1.Text & "','" & txtEmailid2.Text & "','" & cmbProfile.Text & "','" & txtDocument.Text & "', '" & dt & "' ,'" & txtRemarks.Text & "','[B]" & mstream.Read &"' [/B],'" & FN & "')"
    [B]conn.Execute (ssql)[/B]
    MsgBox "New Record has been saved", vbInformation, "Confirmation"
    
    Case 1:
    ssql = "update customer_table set customer_name='" & txtcustomername.Text & "',address='" & txtaddress.Text & "', Phone_No1='" & txtPhoneno1.Text & _
    "',Phone_No2='" & txtPhoneno2.Text & "',Email1='" & txtEmailid1.Text & "',Email2='" & txtEmailid2.Text & "',Profile='" & cmbProfile.Text & "',Docs='" & txtDocument.Text & "', Reg_Date= '" & dt & "' , Remarks= '" & txtRemarks.Text & "' where ID=" & TXTID.Text & ""
    conn.Execute (ssql)
    MsgBox "Existing Record has been updated", vbInformation, "Confirmation"
    End Select
    Call CMDENABLED(True, False, False, False, False)
    Call txtenabled(True, False, False, False, False, False, False, False, False, False)
    Call txtclear
    Call listall
    
    txtcustomername.Clear
    Set rs = conn.Execute("select * from customer_table order by customer_name")
    Do While Not rs.EOF
    With txtcustomername
    .AddItem rs!customer_name
    End With
    rs.MoveNext
    Loop
    End Sub
    Last edited by Rabbit; Jan 7 '14, 03:53 PM. Reason: Please use [CODE] and [/CODE] tags when posting code or formatted data.
  • Honduras2811
    New Member
    • Apr 2014
    • 21

    #2
    How about just a little more information?
    1. Is this a question or an answer?
    2. If it's a question and you are getting an error message, what is it?

    Comment

    Working...