使用 VB 5.0 開發 ActiveX DLL (ImageLoader),負責連接 SQL Server、讀取 image 欄位資料、存成暫存檔供 ASP 取用。
clsImageLoader,Instancing 保留 MultiUse。ImageLoader。| 成員 | 類型 | 用途 |
|---|---|---|
| DbName | Property Let | 資料庫名稱 |
| TableName | Property Let | 資料表名稱 |
| NameOfImageColumn | Property Let | 圖片欄位名 |
| NameOfImageTypeColumn | Property Let | 圖片類型欄位(.gif/.jpg) |
| NameOfImageIdColumn | Property Let | 圖片 ID 欄位 |
| ImageFile | Property Get (ReadOnly) | 回傳暫存檔完整路徑 |
| OpenConnection | Method | 開啟 ADO 連線 |
| CreateTemplateImageFile | Method | 讀取資料庫圖片並存檔 |
Private mAdoConn As New ADODB.Connection
Private mAdoRst As New ADODB.Recordset
Private mstrDbName As String
Private mstrTableName As String
Private mstrImageColumnName As String
Private mstrImageTypeColumnName As String
Private mstrImageIdColumnName As String
Private mstrFileName() As String
Private mlngImageId() As Long
Private mlngNumberOfFiles As Long
Const BLOCKSIZE = 102400
Public Property Let DbName(ByVal strVal As String)
mstrDbName = strVal
End Property
' ... 其他 Property Let / Get / Method 實作 ...
類別內含私有子程序:初始化、終結、開啟 Recordset、寫入檔案、錯誤處理。完整原始碼見原文列表 B。