I used ADO.Stream to load files into both SQL Server and Oracle databases for quite a while. Basically you can upload the file (picture, PowerPoint, pdf) to the SQL table to a OLE or BLOB field. When you need to edit it you need to download it to your local file system somewhere (C:\ - usually the front-end folder), edit it then upload it back and delete the local copy.
The newer versions of SQL Server have newer data types used to store files, you should have a look at these links:
https://docs.microsoft.com/en-us/sql...l-server-ver15
https://stackoverflow.com/questions/...-in-sql-server
Here is the code I used to upload a file:
Code:
Public Sub vcAddFileToBLOB(sFileName As String, lStudentNumber As Long)
Dim sConnectionString As String, RS As ADODB.Recordset, cnnConnection As ADODB.Connection
Dim strStream As Stream, sFileType As String
On Error Resume Next
sFileType = Mid(sFileName, InStrRev(sFileName, ".") + 1)
Set cnnConnection = New ADODB.Connection
Set RS = New ADODB.Recordset
sConnectionString = CurrentDb.TableDefs("tblStting").Connect
sConnectionString = Replace(sConnectionString, "ODBC;", "")
cnnConnection.Open (sConnectionString)
RS.Open "Select * from DB_BE.TBLSTUDENTFILES ", cnnConnection, adOpenKeyset, adLockOptimistic
RS.AddNew
Set strStream = New ADODB.Stream
strStream.Type = adTypeBinary
strStream.Open
strStream.LoadFromFile sFileName
RS.Fields("DOCUMENT").Value = strStream.Read
RS.Fields("STUDENTNUMBER") = lStudentNumber
RS.Fields("CREATEDON") = Now()
RS.Fields("CREATEDBY") = Forms![Main Switchboard Form]![Username]
RS.Fields("FILENAME") = StripLast(sFileName)
RS.Fields("FILETYPE") = sFileType
RS.Update
Set strStream = Nothing
RS.Close
cnnConnection.Close
Set cnnConnection = Nothing
Set RS = Nothing
procExitSub:
Exit Sub
procNoPicture:
GoTo procExitSub
End Sub
Cheers,