Access file in the database

zhaozj2021-02-16  48

'********************************************************** ************************ ** '** 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 end with 'is complete, close the object Ire.close istm.closend Sub

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

New Post(0)