0 Replies - 486 Views - Last Post: 26 February 2011 - 09:35 AM Rate Topic: -----

#1 mhacki  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 07-October 10

save and inserting image into sql server 2008

Posted 26 February 2011 - 09:35 AM

hi good day!

i have a problem of my codes in saving and retrieving image in sql sever 2008 using visual studio 2008. honestly im not good in programming but i want to learn just for my project in my subject. is anyone there good in programming can solve my problem? thanks!

here is my code.. if anyone can check this codes kindly help me.. thanks
//

(saving image)
Private Sub attchpixbtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles attchpixbtn.Click
        If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
            pixbox.ImageLocation = OpenFileDialog1.FileName
        End If
    End Sub



(retrieving image)
   conn.Close()
        DBconnect()

        Dim RST As New ADODB.Recordset
        If RecView.SelectedItems.Count = 0 Then
            MsgBox("select item to view")
            Exit Sub
        End If

     



        RST.Open("SELECT * FROM records WHERE Id='" & RecView.SelectedItems(0).Text & "'", conn, 1, 4, )


   
        Try



            PictureBox1.Image = (RST.Fields("pix").Value)


        Catch
            MsgBox("image opened")
        End Try

        RST.Close()


    End Sub


This post has been edited by macosxnerd101: 26 February 2011 - 11:12 AM
Reason for edit:: Please use code tags


Is This A Good Question/Topic? 0
  • +

Page 1 of 1