Dim cnn1 As ADODB.Connection
Dim rstPubInfo As ADODB.Recordset
Dim strCnn As String
Dim strPubID As String
Dim strPRInfo As String
Dim lngOffset As Long
Dim lngLogoSize As Long
Dim varLogo As Variant
Dim varChunk As Variant
Const conChunkSize = 100
' 打开连接
Set cnn1 = New ADODB.Connection
strCnn = "Provider=sqloledb;" & _
"Data Source=srv;Initial Catalog=pubs;User Id=sa;Password=; "
cnn1.Open strCnn
一个简单的例子。
Open Text12.Text For Binary Access Read As #1
file_length = LOF(file_num)
If file_length > 0 Then
num_blocks = file_length / BLOCK_SIZE
left_over = file_length Mod BLOCK_SIZE
End If
rs!Img_d_len = file_length
ReDim bytes(BLOCK_SIZE)
For block_num = 1 To num_blocks
DoEvents
Get #1, , bytes()
rs!Img_d.AppendChunk bytes()
Next block_num
If left_over > 0 Then
ReDim bytes(left_over)
Get #1, , bytes()
rs!Img_d.AppendChunk bytes()
End If