Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: Image Access through database


Message #1 by "Nitai" <san1971@s...> on Thu, 28 Dec 2000 05:23:39 -0000
I guess I missed a piece...you also need to at some point create the
recordset, so the code is more like this:

<vbcode>
Dim cn as ADODB.Connection
Dim rs as ADODB.recordset
Dim mstream as ADODB.Stream

Set cn = new Connection
cn.open "<your connection string>"

Set rs = new recordset
rs.open "SELECT MyBlobField FROM MyTable", cn, <your cursor and locking
settings>

Set mstream = new Stream
mstream.type = adTypeBinary
mstream.open

'=== File to DB Field ===
mstream.LoadFromFile "<path to file to read>"
rs.fields("MyBLOBField").Value = mstream.read
rs.Update

'=== DB Field to File ===
mstream.write rs.fields("MyBLOBField").Value
mstream.SaveToFile "<path to save to>", adSaveCreateOverwrite

rs.close
cn.close
set rs = nothing
set cn = nothing
</vbcode>




------------------------------------------
Christopher Tacke, MCSD
Rubicon Technologies
(xxx)xxx-xxxx  x 319



---
You are currently subscribed to pro_vb as: $subst('Recip.EmailAddr')
To unsubscribe send a blank email to leave-pro_vb-$subst('Recip.MemberIDChar')@p2p.wrox.com

  Return to Index