se puede insertan una imagen

Alex
07 de Marzo del 2006
Hola a tod@s, me gustaria sabes si se puede poner una imagen en el a base de datos,aciendola con SQL,
si alguin lo suopiera que me diga con el programa que utiliza,gracias

Relas
07 de Marzo del 2006
Amigos, aquí está el código tan esperado.

'1.- SE ESTABLECE EL ARCHIVO DE LA IMAGEN A LA CONEXION ADOSTREAM
Dim SetImagen As New ADODB.Stream
SetImagen.Type = adTypeBinary
SetImagen.Open

SetImag.LoadFromFile "RutaArchivo.jpg"

'2.- SE ABRE UN RECORDSET, USTEDES PUEDEN ABRIRLO A SU MODO, YO UTILICE UNA CADENA DE CONEXION
Dim ObjetoRecordset As New ADODB.Recordset
ObjetoRecordset.ActiveConnection = "Provider=SQLOLEDB;Data Source=SuServidor;Database=SuBase;UID=SuUsuario;PWD=SuPassword;"
SQL = "Su Query"
ObjetoRecordset.Source = SQL
ObjetoRecordset.CursorType = adOpenStatic
ObjetoRecordset.CursorLocation = adUseServer
ObjetoRecordset.LockType = adLockOptimistic
ObjetoRecordset.Open

'3.- SE ASIGNA LA CONEXION ADOSTREAM A EL RECORDSET Y SE GUARDA
ObjetoRecordset.Source!FotoEmpleado = SetImag.Read
ObjetoRecordset.Update

'NOTAS. SE PUEDEN INCLUIR OTROS CAMPOS DE LA BASE PARA ASI AL MISMO TIEMPO GUARDAR OTROS DATOS
'ESTE CODIGO MANEJA LA REFERENCIA AL ADO Microsoft ActiveX Data Objects 2.8 Library que viene con el MDAC 2.8