Hii All,
I havea problem with uploading Images into Database(MS Sql2000)..
and i want to retrive them back..
Please do favour to me..

Private Sub btnadd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnadd.Click
        Dim fst As New FileStream(OpenDialog.FileName, FileMode.Open, FileAccess.Read)
        Dim s As String = cmb1.SelectedIndex
        Dim br As BinaryReader = New BinaryReader(fst)
        Dim buffer(fst.Length) As Byte
        br.Read(buffer, 0, CInt(fst.Length))
        fst.Close()
        InsertImage(buffer, s)
    End Sub
    Public Function InsertImage(ByRef buffer, ByVal str)
        SqlConnection1.Open()
        Try
            Dim com As New SqlCommand
            com.Connection = SqlConnection1
            com.CommandText = "insert into photo(image)values(@image)"
            com.Parameters.Add("@image", SqlDbType.Image).Value = buffer
            com.ExecuteNonQuery()
            MsgBox("IMAGE INSERTED SUCCESSFULLY")
        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try
        SqlConnection1.Close()
    End Function
    Private Sub DrawToScale(ByVal bmp As Image)
        picbox.Image = New Bitmap(bmp)
    End Sub

THIS WILL ADD TEH SELECTED IMAGE TO THE SQL SERVER DATABASE AND TO SELECT........

=>USE PIC BOX ON FORM
=>DRAG OPENDIALOG TO THE FORM AND THEN BROWSE THE IMAGE FROM THE HARD DRIVE

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.