Escribir:
1: Lea el archivo de imagen GIF en la memoria (una variable strtemp).
2: Escribe en la base de datos.
dim bintmp () como byte
Dim Conn como ADODB.Connection
Dim RS como ADODB.Recordset
Dim strsql como cadena
establecer conn = new ADODB.Connection
establecer rs = nuevo ADODB.RecordSet
Conn.open "DB"
strsql = "Seleccionar * de tbimage"
Rs.Preen Strsql, Conn, 1, 3
OpenFile ("bayshore.jpg")
'Implemente la función OpenFile usted mismo
Rs.addnew
Rs.fields ("Imagen"). AppendChunk bintmp
rs.
Leer y mostrar:
show.asp:
<%
DiM P
dim l
L = 8192
Dim Conn, Rs, Strsql
establecer conn = server.createObject ("ADODB.Connection")
Conn.open "Provider = Microsoft.Jet.OLEDB.4.0; Data Source =" & Server.Mappath (".") & "/db2.mdb; Persist Security Info = False"
establecer rs = server.createObject ("ADODB.Recordset")
strsql = "Seleccionar * de tbimage"
Respuesta.ContentType = "Image/GIF"
'¡importante!
Rs.open Strsql, Conn, 1,1
Rs.movelast
hacer
P = RS ("Imagen"). GetChunk (L)
Respuesta.BinaryWrite P
Si Lenb (p) <l entonces salga
bucle
%>
En html:
<Imagen src = show.asp>