' 建立表 Ver 表结构为: f001 标识增量字段,f002 nvarchar(50) 文件名,f003 nvarchar(50) 版本号,f004 image 存储文件,f005 datetime 上传日期时间,f006 存储f004中exe文件的最后修改时间,以上字段均非空
' f007 nvarchar(50)SQL文件名称 ,f008 image SQL文件 ,f009 nvarchar(50)控件文件名称,f010 image 控件文件,f011 nvarchar(50)控件注册文件名,f012 image 控件注册文件‘
'保存为文件
Public Sub SaveToFile(ByVal sFileName As String, Field As String)
'
' Export the file from the database to the passed filename
'
Dim iFileNum As Integer
Dim lFileLen As Long
Dim lChunks As Long
Dim lFragment As Long
Dim bChunk() As Byte
Dim lCount As Long
Dim oField As Field
Dim oRS As New ADODB.Recordset
Const CHUNKSIZE As Long = 16384 ' internal chunksize
On Error GoTo ErrorHandler
'
' Get the field from the database
'
DBOpen oRS, "select * from ver where f001=(select max(f001) from ver)"
If oRS.BOF Or oRS.EOF Then GoTo PROC_EXIT
iFileNum = FreeFile
'
' Create the Named File
'
Open sFileName For Binary Access Write As iFileNum
Set oField = oRS.Fields(Field)
'
' Get the length of the file and the number of chunks required
lFileLen = oF