GetChunk, Text, and ADO

GetChunk, Text, and ADO

Post by Tim Sap » Sat, 08 Jul 2000 04:00:00



I have a table that I created on a SQL 2000 box.  One of the fields has a
data type of Image.   I wrote the code that gets a video file up to the
server but I'm having trouble getting it back out.  Here is the code that I
am trying.

Public Sub DownloadVideo(VidName As String)
Dim DataFile As Integer
DataFile = 1

Set CNN1 = New ADODB.Connection
With CNN1
    .ConnectionString = "DSN=VideoData"
    .Mode = adModeReadWrite
    .Open
End With

Set MyRS = New ADODB.Recordset

With MyRS
    .ActiveConnection = CNN1
    .LockType = adLockOptimistic
    .Source = "Select * From Videos Where VideoName = '" & VidName & "'"
    .CursorType = adOpenKeyset
    .Open
End With

Open VideoSourceDir & VidName For Binary Access Write As DataFile

F1 = MyRS!Video.ActualSize
Chunks = F1 \ ChunkSize
Fragment = F1 Mod ChunkSize
Chunk() = MyRS!Video.GetChunk(Fragment)
Put DataFile, , Chunk()
ReDim Chunk(ChunkSize)
For I = 1 To Chunks
   Chunk() = MyRS!Video.GetChunk(ChunkSize)
   Put DataFile, , Chunk()
Next 'I

Close DataFile

MyRS.Close
CNN1.Close

End Sub

One of the videos that I am trying to get is 2.6 MB the other is 100MB.
When I try and pull the 100MB file I get the .ActualSize value of 7 and the
.DefinedSize is 2147483647.  Right now I am on a 100mb network so I have the
chunk size set to 65536.  It goes up with no problems with this chunk size.
Any solutions out there?

Tim Sapp

 
 
 

1. HELP: Sybase TEXT field and GetChunk()

I'm writing a VB5 app accessing a Sybase db.  I seem to be having
trouble reading & writing to a Sybase Text field.  Does anyone have any
advice and/or examples they could share?

Thanks in advance.

Chris LeeTom

2. Microsoft DTS Task Kit (OLAP)

3. ADO GetChunk returns null

4. Populating a SQL DB from Text files

5. VBA/ADO 1.5 - GetChunk buffers larger than 1K

6. DOA with dBase/Foxpro

7. ADO GetChunk returns Null

8. Error

9. ADO GetChunk

10. Q:ADO GetChunk ?

11. ADO with GetChunk and Image datatype

12. Problem with ADO, Getchunk and Appendchunk in SQL7 and VB6

13. HELP!!! ADO GetChunk method in an ASP page