January 20, 2004 at 8:35 am
Does anyone have any good tips on how to use BLOBs to store image/videos within SQL Server and how to access them with ADO methods?
Cheers!
If riding in a plane is flying, then riding in a boat must be swimming. To experience the element, get out of the vehicle. Skydive!
January 20, 2004 at 8:50 am
This one is to store the data
Dim strStream As ADODB.Stream
Set strStream = New ADODB.Stream
strStream.Type = adTypeBinary
strStream.Open
strStream.LoadFromFile sFileName
DoEvents
Fields("MsgAttachment").Value = strStream.Read
....
This one is to retrieve the data
Dim strStream As ADODB.Stream
sql = "SELECT MsgAttachment FROM mails_attachments WHERE id=" & CLng(DataList3.BoundText)
Set rs = New ADODB.Recordset
cnnArchive.Open SNIPPET_STRING
rs.Open sql, cnnArchive, adOpenDynamic, adLockOptimistic, adCmdText
Set strStream = New ADODB.Stream
strStream.Type = adTypeBinary
strStream.Open
strStream.Write rs.Fields("MsgAttachment").Value
strStream.SaveToFile CommonDialog1.FileName, adSaveCreateOverWrite
And all is done with an image column in SQL Server.
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
January 20, 2004 at 8:56 am
Is there a spcific source from where you got these examples?
If riding in a plane is flying, then riding in a boat must be swimming. To experience the element, get out of the vehicle. Skydive!
January 20, 2004 at 9:04 am
Or ive heard I could simply use an HTTP pointer to retrieve the image/video from a file rather than storing it in a database?
Is this maybe an easier option? Certainly more effective performance wise?
If riding in a plane is flying, then riding in a boat must be swimming. To experience the element, get out of the vehicle. Skydive!
January 21, 2004 at 12:28 am
Well, yes there is a specific source from where I got these examples. They are part of my small app to move research reports from email to database.
It sometimes appears to be a rather religious question which method to use. The answer is, that there is no ultimate answer. All I can give you is this link http://www.microsoft.com/technet/treeview/default.asp?url=/technet/prodtechnol/sql/reskit/sql2000/part3/c1161.asp and then it is up to you to decide which way to go.
As you've mentioned videos, I guess the filesystem alternative would be better suited.
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply