Access - Convertir un campo con imagenes tipo binarios a tipo ole gif

 
Vista:

Convertir un campo con imagenes tipo binarios a tipo ole gif

Publicado por Ing. Berta Guerrero (2 intervenciones) el 27/01/2017 16:56:16
Hola buen día mi gente

Soy de Panamá

Necesito una gran ayuda..

Tengo una Base de datos a la cual se le diseño una ficha catastral, de la cual cuando buscas una cedula catastral te trae la información de propietarios como colindantes, entre cedula y firmas...que sucede, la firma es un campo tipo OLE creada desde un inicio en oracle y guardada como datos binarios.
Necesito convertirlo de datos binarios a tipo gif o jpg.......
Y por otro lado quiero guardarlo en una tabla local..
ya que si se dan cuenta, se guarda en el disco C y no lo quiero en disco C, lo quiero en una tabla local que hice...llamada la Tabla= IMAGEN

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
Sub Cargar_Imagen()
Dim ADO_Connection As ADODB.Connection
Dim rs As ADODB.Recordset
Dim rs2 As ADODB.Recordset
Dim Stream As ADODB.Stream
 
 'SELECION GENERAL DEL CICLO
 'Set rs2 = New ADODB.Recordset
 Set rs = New ADODB.Recordset
 Set ADO_Connection = CurrentProject.Connection
 'SQL = "SELECT * FROM dbo_V_colindantes where CEDULA_CATASTRAL_PREDIO = '4243215140413'"
 ' rs2.Open SQL, ADO_Connection, adOpenKeyset, adLockOptimistic
 ' If rs2.RecordCount = 0 Then
      ' S'et Leer_Imagen = Nothing
       'rs2.Close
     '  Set rs2 = Nothing
     '  Exit Sub
' End If
   ' rs2.MoveFirst
    Dim cedula As String
 
 
'Dim contador As Integer
'contador = 31
  'While Not rs2.EOF
 
  'cedula = Me.CEDULA_RUC.Value
   cedula = Reports!Informe1![subinforme ColindantesyFirmas]!CEDULA_RUC.Value
     SQL2 = "SELECT * FROM dbo_V_Firmas_propietario_ocupante where CEDULA_RUC  = '" & cedula & "'"
     rs.Open SQL2, ADO_Connection, adOpenKeyset, adLockOptimistic
     Campo_Imagen = "FIRMA"
 
 
 
If rs.RecordCount = 0 Then
 
      ' Set Leer_Imagen = Nothing
           rs.Close
       Set rs = Nothing
       Exit Sub
End If
 
 
     rs.MoveFirst
 
 
    Set Stream = New ADODB.Stream
 
    ' Especifica el tipo de datos ( binario )
    Stream.Type = adTypeBinary
    Stream.Open
 
    ' verifica con la función IsNull que el campo no tenga _
     un valor Nulo ya que si no da error, en ese caso sale de la función
    If IsNull(rs.Fields(Campo_Imagen).Value) Then
       ' GoTo error_Function
    End If
    ' Graba los datos en el objeto stream
    Stream.Write rs.Fields(Campo_Imagen).Value
 
    ' este método graba un  archivo temporal  en disco _
     ( en el app.path que luego se elimina )
    'Stream.SaveToFile "C:\IMAGEN\PRUEBA.GIF", adSaveCreateOverWrite
 
Stream.SaveToFile "C:\IMAGEN\colindantes\" & cedula & ".GIF", adSaveCreateOverWrite
    ' Retorna la imagen a la función
 
    '''''''''''''
 
   Reports!Informe1![subinforme ColindantesyFirmas]!Imagen6.Picture = "C:\IMAGEN\colindantes\" & cedula & ".GIF"
   'Imagen32.Picture = "C:/IMAGEN/colindantes/" & cedula & ".GIF"
 
     '''''''''''
 
    'Cierra el recordset y el objeto Stream
    If rs.State = adStateOpen Then
        rs.Close
   End If
   If Not rs Is Nothing Then
       ' Set rs = Nothing
    End If
 
    If Stream.State = adStateOpen Then
        Stream.Close
    End If
    If Not Stream Is Nothing Then
        Set Stream = Nothing
    End If
 
  'rs.Close
 
 
    'Set rs = Nothing
   'rs2.MoveNext
   contador = contador + 1
'Wend
 
'MsgBox " Fin de Proceso"
 
 
End Sub
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder