Binary Data from SQL database to actual FIle?
Posted on 2003-03-07
I'm developing a system to house all kinds of files in a SQL database. I need to be able to send these files via email, so I'm trying to create a temp file to attach to the email that is generated. I'm able to create an empty file, open it for writing but I'm getting error when i try to put the file. My Question is do I need to loop through the data byte by byte or can I just dump the whole thing. Either way I'd appreciate the code for the PUT statement or the loop?
This is the code that's generating the error
intFileNumber = FreeFile
Open str For Binary Access Write Lock Read Write As #intFileNumber
'Write binary data to the file
Put #intFileNumber, , objRecordSet("binary_data")
'Close the file
Thanx in advance