2 Replies - 621 Views - Last Post: 30 August 2011 - 12:27 AM Rate Topic: -----

#1 Guest_rasingh*


Reputation:

How to retrieve image from data base

Posted 28 August 2011 - 01:19 PM

I have tried following code to retrieve image from my database.
Dim sEmpID As String
            sEmpID = TxtPisno.Text
            If sEmpID.Trim = "" Then
                Exit Sub
            End If

            Dim CmdER As New OleDbCommand
            Dim MyReader As OleDb.OleDbDataReader
            CmdER.Connection = Mycon
            CmdER.CommandText = "select * from EmployeeMaster1 where pisno = '" & sEmpID & "'"
            MyReader = CmdER.ExecuteReader

            If MyReader.Read() Then
                TxtPisno.Text = MyReader("pisno")
                TxtName.Text = MyReader("Ename")
                Txtpost.Text = MyReader("post")
                TxtCoy.Text = MyReader("coy")
                PicPhoto.Image = MyReader (ctype (Binarywrite("Picture")))
            Else
                MsgBox("This PIS No is not a member of this database")
                TxtPisno.Text = (" ")
                TxtPisno.Focus()
            End If

but i could not get success. please

This post has been edited by modi123_1: 28 August 2011 - 01:36 PM
Reason for edit:: please use code tags


Is This A Good Question/Topic? 0

Replies To: How to retrieve image from data base

#2 DimitriV  Icon User is offline

  • They don't think it be like it is, but it do
  • member icon

Reputation: 584
  • View blog
  • Posts: 2,738
  • Joined: 24-July 11

Re: How to retrieve image from data base

Posted 29 August 2011 - 08:23 PM

Have you tried (and I'm not sure if it'll work):
PicPhoto.image=MyReader("Picture")

Was This Post Helpful? 0
  • +
  • -

#3 Guest_rasingh*


Reputation:

Re: How to retrieve image from data base

Posted 30 August 2011 - 12:27 AM

View PostjimmyBo, on 29 August 2011 - 08:23 PM, said:

Have you tried (and I'm not sure if it'll work):
PicPhoto.image=MyReader("Picture")



Yes , I have tried that one also but not succeeded.

Yes , I have tried that one also but not succeeded.
Was This Post Helpful? 0

Page 1 of 1