Access file in the database

zhaozj2021-02-16  62

Title database Access file zjcxc (original) keyword file access, stream

'********************************************************** ************************ ** '** Using AdoDb.Stream Save / Read Files to Database' ** Reference Microsoft ActiveX Data Objects 2.5 Library and above version '**' ** ----- Database connection string template ---------------------------------------------------------------------------------------------------------------------------------- --------- '** Access database' ** iconcstr = "provike = microsoft.jet.Oledb.4.0; persist security info = false" & _ '** "; data source = database name" ** '** SQL Database' ** iconcstr = "Provider = SQLOLEDB.1; PERSIST Security Info = True;" & _ '** "User ID = User Name; Password = Password; Initial Catalog = Database Name; Data Source = SQL server name "" ** '************************************************** ******************************** Save files to the database Sub s_savefile () DIM ISTM AS AdoDDB.Stream Dim Ire as adodb.recordset Dim iconcstr AS String 'database connection string iconcstr = "provider = microsoft.jet.OLEDb.4.0; persist security info = false" & _ "; data source = f: / my documents / customer data 1. MDB "'reading files to content set istm = new adod.com.stream with istm .type = adtypebinary' binary mode .open .loadFromfile" c: /test.doc "End with 'Open the list of saved files set IRE = new adod.com "table", iconc, adopenkeyset, additional record .fields ("Save File content field") = Istm.Read .update After the end with 'is complete, turn off the object Ire.close istm.closend sub' read data from the database, save into file sub s_readfile () DIM ISTM AS AdoDB.Stream Dim Ire as adoDDB.Recordset DIM ICONC AS STRING 'Database Connection String Iconc = "provider = microsoft.jet.Oledb.4.0; persist security info = false" &

转载请注明原文地址:https://www.9cbs.com/read-16975.html

New Post(0)