Yo también tuve ese problema, pero lo resolví utilizando un campo [TEXTO/VARCHAR] dentro de la base de datos para almacenar una cadena que identifique la ruta del archivo de imagen .JPG, luego cargo en el control de la imagen la ruta desde la base de datos.
ESTO CON EL METODO DE PROGRAMACION ADO por codigo DE VISUAL BASIC 6 MIGRADO A VISUAL BASIC . NET
TIENES QUE AGREGAR UNA REFERENCIA TIPO [COM] A Microsoft ActiveX Data Objects 2.0 Library u otra
ESCRÍBEME UN CORREO PARA SABER SI TE SIRVIÓ .... TENGO VARIOS SISTEMAS COMPLETOS....
[email protected]
UTILIZO UN OBJETO PICTUREBOX
EN EL FORMULARIO
================
Dim ruta As String
Private Sub limpiar()
txtdni.Text = ""
txtfotocheck.Text = ""
txtapaterno.Text = ""
txtamaterno.Text = ""
txtnombre.Text = ""
picturefoto.Image = Image.FromFile("D:\rrhh\fotos\sinfoto.jpg")
txtestadocivil.Text = ""
txtsueldo.Text = ""
End Sub
Function LlenarControles()
On Error Resume Next
If RsEmpleado.BOF Or RsEmpleado.EOF Then
limpiar()
Else
txtdni.Text = IIf(CamposEmpleado.Item("Emp_DNI").Value Is DBNull.Value, "", CamposEmpleado.Item("Emp_DNI").Value)
txtfotocheck.Text = IIf(CamposEmpleado.Item("emp_FOTOCHECK").Value Is DBNull.Value, "", CamposEmpleado.Item("emp_FOTOCHECK").Value)
txtapaterno.Text = IIf(CamposEmpleado.Item("emp_APaterno").Value Is DBNull.Value, "", CamposEmpleado.Item("emp_APaterno").Value)
txtamaterno.Text = IIf(CamposEmpleado.Item("emp_AMaterno").Value Is DBNull.Value, "", CamposEmpleado.Item("emp_AMaterno").Value)
txtnombre.Text = IIf(CamposEmpleado.Item("emp_Nombre").Value Is DBNull.Value, "", CamposEmpleado.Item("emp_Nombre").Value)
ruta = IIf(CamposEmpleado.Item("emp_Foto").Value Is DBNull.Value, "", CamposEmpleado.Item("emp_Foto").Value)
If ruta = "" Then ruta = "D:\rrhh\fotos\sinfoto.jpg"
picturefoto.Image = Image.FromFile(ruta)
txtestadocivil.Text = IIf(CamposEmpleado.Item("emp_EstadoCivil").Value Is DBNull.Value, "", CamposEmpleado.Item("emp_EstadoCivil").Value)
txtsueldo.Text = IIf(CamposEmpleado.Item("Sueldo_Bas").Value Is DBNull.Value, "", CamposEmpleado.Item("Sueldo_Bas").Value)
End If
End Function
Private Sub frmEmpleados_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Call abrirempleado()
CamposEmpleado = RsEmpleado.Fields
LlenarControles()
End Sub
Private Sub cmdprimero_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdprimero.Click
If RsEmpleado.RecordCount > 0 Then
RsEmpleado.MoveFirst()
LlenarControles()
End If
End Sub
Private Sub cmdultimo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdultimo.Click
If RsEmpleado.RecordCount > 0 Then
RsEmpleado.MoveLast()
LlenarControles()
End If
End Sub
EN UN MODULO:
=============
Imports System.Data.SqlClient
Imports System.Data
Imports System.Data.OleDb
Imports ADODB
Module ModConexion
Public cn As ADODB.Connection
Public RsEmpleado As ADODB.Recordset
Public CamposEmpleado As ADODB.Fields
'para SQL Server
Public Function abrir()
Dim cadconect As String
cn = New ADODB.Connection
cadconect = "Driver={SQL Server};" & _
"server=(local);" & _
"Uid=sa;Pwd=sql;database=rrhh"
cn.Open(cadconect)
End Function
'para Access 2000
Public Sub abrirbase()
cn = New ADODB.Connection
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=rrhh.mdb;" 'para access2000
cn.Open()
End Sub
Public Sub abrirempleado()
RsEmpleado = New ADODB.Recordset
With RsEmpleado
.ActiveConnection = cn
.CursorLocation = ADODB.CursorLocationEnum.adUseClient
.CursorType = CursorTypeEnum.adOpenStatic
.LockType = LockTypeEnum.adLockOptimistic
.Open("Select * from EMPLEADO order by Emp_APaterno")
End With
End Sub
End Module
UN BESO