Re: Passing VARBINARY/BINARY param to a stored proc

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: William \(Bill\) Vaughn (billvaRemoveThis_at_nwlink.com)
Date: 08/21/04


Date: Fri, 20 Aug 2004 20:20:40 -0700

How was the Command constructed? How did you cast the Parameter?

-- 
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
"Chris" <chrisx@NOSPAM.com> wrote in message 
news:OfG9KgshEHA.1184@TK2MSFTNGP12.phx.gbl...
> My VB6 program is having problems using ADO (2.7) to pass a Byte array to 
> a
> VARBINARY parameter in an SQL Server 2000 stored procedure.  I get an 
> error
> "3421:Application uses a value of the wrong type for the current 
> operation"
> when calling the Execute method.
>
> If I set Parameter(2).Value = Null then everything works OK.  I've 
> confirmed
> that I'm updating the correct ADOParameter.  Prior to calling Execute, the
> Value is an array.  I've even commented out the stored procedure code so
> that the parameter is ignored.  Can someone point me in the right 
> direction
> please?
>
> My code is as follows:-
>
> Dim vData() As Byte
> Dim Proc As Command
>
> // Code to redimension & populate vData()...
>
> Set Proc = New ADODB.Command
> With Proc
>  Set .ActiveConnection = myDatabase.Connection
>  .CommandText = "MY_PROCEDURE"
>  .CommandType = adCmdStoredProc
>  .Parameters(1).Value = 1
>  .Parameters(2).AppendChunk vData()
>  .Execute
> End With
>
> 


Relevant Pages

  • Re: Design question/tablelist
    ... moving common functions and GUI options into package code instead of ... The tablelist code chokes in the aquahig::aquatable proc, ... catch {destroy .dirview} ... By the looks of the error, you have an image named after some command ...
    (comp.lang.tcl)
  • Re: function and structures
    ... lines,, i want to implement the same in TcL. ... is to assign to it with a set command (or some other commands such ... probably the best way is to use a Tcl array. ... Functions are declared with the proc command: ...
    (comp.lang.tcl)
  • Re: Confused newbie
    ... Write a proc, test it interactively ... never forget that when you write a loop or a conditional, ... the opening brace of the controlled script should go on the ... intuitive command line editing. ...
    (comp.lang.tcl)
  • Re: Design question/tablelist
    ... The tablelist code chokes in the aquahig::aquatable proc, ... catch {destroy .dirview} ... By the looks of the error, you have an image named after some command ... dialog seems to be failing trying to create a text widget. ...
    (comp.lang.tcl)
  • Interaction with an application.
    ... msg thread created. ... Now I am able to make a call to bscsim, but the script of my tk file ... ../final.tk: proc: command not found ...
    (comp.lang.tcl)