Retrieve an Image which is saved in database (Oracle)

Retreive an image from database

Page 1 of 1

0 Replies - 1147 Views - Last Post: 23 December 2009 - 04:01 AM Rate Topic: -----

#1 Naveen10  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 23-December 09

Retrieve an Image which is saved in database (Oracle)

Post icon  Posted 23 December 2009 - 04:01 AM

How to retreive an image from Oracle database which is saved in Binary format and how to save the picture in our local System !!

Following is the code written to insert an image captured by web cam !!


Dim hwdc As Long
Dim startcap As Boolean
Dim DataFile As Integer
Dim Chunks As Integer
Dim Fragment As Integer, Chunk() As Byte, i As Integer, filename As String
Private Const ChunkSize As Integer = 16384
Private Const conChunkSize = 100


Private Sub cmdCapture_Click()
Dim temp As Long

  hwdc = capCreateCaptureWindow("Dixanta Vision System", WS_CHILD Or WS_VISIBLE, 0, 0, 320, 240, Picture1.hwnd, 0)
  If (hwdc <> 0) Then
	temp = SendMessage1(hwdc, WM_CAP_DRIVER_CONNECT, 0, 0)
	temp = SendMessage1(hwdc, WM_CAP_SET_PREVIEW, 1, 0)
	temp = SendMessage1(hwdc, WM_CAP_SET_PREVIEWRATE, 30, 0)
	startcap = True
   ' UpdateRecord
	Else
	MsgBox ("No Webcam found")
  End If

End Sub

Private Sub CmdClose_Click()
Dim temp As Long
If startcap = True Then
temp = SendMessage1(hwdc, WM_CAP_DRIVER_DISCONNECT, 0&, 0&)
startcap = False
 UpdateRecord
Unload Me
End If
End Sub

Private Sub cmdVideoFormat_Click()
Dim temp As Long
 If startcap = True Then
  temp = SendMessage1(hwdc, WM_CAP_DLG_VIDEOFORMAT, 0&, 0&)
End If
End Sub
Private Function UpdateRecord() As UpdateRecordConstants
	On Error GoTo errhandler
	Dim ValidateResult As ValidateRecordConstants
'	ValidateResult = ValidateRecord
	If ValidateResult = EmptyVRecord Then
		UpdateRecord = EmptyURecord
		Exit Function
	ElseIf ValidateResult = InValidVRecord Then
		UpdateRecord = InvalidURecord
		Exit Function
	End If

	Dim RsPATIENTIMAGEDET  As New ADODB.Recordset
	Dim Sql As String
	Set RsPATIENTIMAGEDET = New ADODB.Recordset
	Sql = "Select * from PATIENTIMAGEDET where 1=2 "
	RsPATIENTIMAGEDET.Open Sql, HospConn, adOpenDynamic, adLockOptimistic
	RsPATIENTIMAGEDET.AddNew
	RsPATIENTIMAGEDET.Fields("PATIENTIMAGENO") = 5
	RsPATIENTIMAGEDET.Fields("REGISTRATIONNO") = 11
	RsPATIENTIMAGEDET.Fields("TESTNAME") = "Naveen"
	RsPATIENTIMAGEDET.Fields("TESTDATE") = Now
	RsPATIENTIMAGEDET.Fields("IMAGE") = hwdc
	RsPATIENTIMAGEDET.Fields("ENTRYDATE") = Now
	RsPATIENTIMAGEDET.Fields("CANCELLED") = "N"
	RsPATIENTIMAGEDET.Fields("USERNO") = 22
	RsPATIENTIMAGEDET.Fields("EXT") = "Y"
	RsPATIENTIMAGEDET.Update
	'ClearRecord
	MsgBox "Updated Successfully"
	UpdateRecord = ValidURecord

errhandler:
MsgBox ERR.Description
End Function

Private Sub Form_Load()
'Dim RsPATIENTIMAGEDET  As New ADODB.Recordset
'RsPATIENTIMAGEDET.Open "select IMAGE from PATIENTIMAGEDET", con, adOpenDynamic, adLockOptimistic
 Dim RsPATIENTIMAGEDET  As New ADODB.Recordset
	Dim Sql As String
	Set RsPATIENTIMAGEDET = New ADODB.Recordset
	Sql = "select IMAGE from PATIENTIMAGEDET where REGISTRATIONNO = 11"
	RsPATIENTIMAGEDET.Open Sql, HospConn, adOpenDynamic, adLockOptimistic
ShowPic
End Sub


Thanks in Advance !!

Is This A Good Question/Topic? 0
  • +

Page 1 of 1