Solved

ADo - Append chunk - Passing a blob greater than 64K as a stored procedure parameter

Posted on 2004-10-20
8
1,021 Views
Last Modified: 2013-12-25
Hi,

I'm having problems passing a Blob greater than 64k. If I add a single chunk less than 64k there is no problem .. if I add multiple chunks I get an error on the cmd.Execute line. The error is:
"Application uses a value of the wrong type for the current operation." I've seen this error before when you pass a chunk greater than that specified. If I try pass a chunk greater than 64k I get an errrr due to data truncation.

I'm currently breaking my blob (byte array) into chunks of 60k.

 Here's a code extract:

    MaxChunkSize = 60000
    Set prmData = cmd.CreateParameter("ReportFileData", adLongVarBinary, adParamInput, MaxChunkSize + 1)
   
    prmData.Attributes = adFldLong
    cmd.Parameters.Append prmData
   
    For each Chunk in colChunks
        prmData.AppendChunk Chunk
    Next
    cmd.Execute
   

Any ideas how to append this large blob ?
Alan.

0
Comment
Question by:aregan
  • 3
  • 2
8 Comments
 
LVL 29

Expert Comment

by:leonstryker
ID: 12358979
0
 

Author Comment

by:aregan
ID: 12359454
Thanks Leon...

I've just tried implenting ADO Stream but not all going to plan.
When I try to set my parameter value to the stream.read I'm getting an error saying it cannt be used in this context ....

 - here's an extract


    Set prmBin = cmd.CreateParameter("ReportFileData", adLongVarBinary, adParamInput, CHUNKSIZE + 1)
    prmBin.Attributes = adFldLong
    cmd.Parameters.Append prmBin
   
   
    Set ADOStream = New ADODB.Stream
    With ADOStream
        .Open
        .LoadFromFile MyBigFileName
        .Position = 0
        prmBin.Value = .Read
    End With
   
    cmd.Execute

0
 
LVL 29

Expert Comment

by:leonstryker
ID: 12359610
What are you loading? look at the example on the bottom of the page in the second link.

Leon
0
 

Author Comment

by:aregan
ID: 12359884

I was trying to base it on that example but the example updates a recordset blob...
I'm trying to pass a blob parameter to a stored procedure.

A.
0
 
LVL 29

Accepted Solution

by:
leonstryker earned 50 total points
ID: 12360167
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now