Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2004-10-20
8
Medium Priority
?
1,057 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
 

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 200 total points
ID: 12360167
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
Suggested Courses

972 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