Solved

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

Posted on 2004-10-20
8
1,038 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

752 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