Saves the file specified to the database as a BLOB using ODBC.
Connect is an ODBC connection string which may use a system DSN,
or be DSNless, for example:
"DSN=mydb;UID=sa;PWD=xxxxx"
or
"Driver={Microsoft Access Driver (*.mdb)};DBQ=c:\path\db.mdb"
However Connect cannot be an ADO-style connection string, i.e. it
cannot reference an OLD DB provider, as this method is based on ODBC.
SQL is an SQL INSERT or UPDATE statement which uses the sign ?
as a placeholder for the file being saved in the database, for example:
"INSERT INTO mytable(image_blob, path) values(?, 'c:\path\file.ext')"
or
"UPDATE mytable SET imageblob = ? WHERE id = 15"
The MSAccessHeaders parameter may only be used with MS Access databases.
If set to True, AspUpload will attempt to save the file not as a Blob but as
an OLE Object so that the document can be invoked directly from MS Access
by double-clicking on the table field. This feature will only work with
file types for which OLE document servers exist, such as MS Word documents (*.doc),
Excel workbooks (*.xls), bitmaps (*.bmp), etc. For other types of files
(such as *.gif) the MSAccessHeaders parameter will be ignored and assumed False.
Note that you will not be able to download a document saved as an OLE Object
directly to the browser.
Usage:
File.ToDatabase "DSN=mydb;UID=sa;PWD=xxxx;", "insert into myimages(image_blob) values(?)"
Relevant Chapters: 4