Solved

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

Posted on 2004-10-20
8
1,026 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

776 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