Re: ADO call to user defined function

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: Val Mazur (group51a_at_hotmail.com)
Date: 05/21/04


Date: Thu, 20 May 2004 22:19:07 -0400

Hi,

Since you cannot call UDF from the code directly, what you could do is to
wrap them into the stored procedure and call SP

-- 
Val Mazur
Microsoft MVP
"MS news" <Me@SBrickey.net> wrote in message 
news:%23jCWxwdPEHA.4036@TK2MSFTNGP12.phx.gbl...
> hello,
>
> I recently decided that one of my stored procedures (which works fine) 
> would
> be better fit as a (scalar) user defined function. I used QA to move the
> code, and tested, and it works fine. Unfortanately ASP feels differently, 
> as
> I get the error "Restricted data type attribute violation".
>
> here is a snippet of the code...
> AdoCom.CommandText = "GetPricingBranchProductCost"
> AdoCom.CommandType = AdCmdStoredProc
> AdoCom.Parameters.Append AdoCom.CreateParameter("@ProdID", AdBigInt,
> AdParamInput, , ProdID)
> AdoCom.Parameters.Append AdoCom.CreateParameter("@BrID", AdBigInt,
> AdParamInput, , BrID)
> Set AdoRS = AdoCom.Execute
>
> it blows up on the .Execute
> I was concerned that the CommandType would be incorrect, and tried other
> values (&H0001 and &H0008, for text and unknown, seemed to work best; but
> complained about lacking parameters) but have had no success.
>
> from what little i've found about calling UDF's from within ADO, 
> commandtype
> SHOULD work as stored proc (though this may be wrong)...
> but when the SQL code WAS a stored proc, i never got these errors.
>
> Any ideas appreciated.
> Thanks,
> -Scott
>
> 


Relevant Pages

  • Re: Update statement performance decreases in stored proc
    ... Have you had a look at the execution plan of the stored procedure? ... Here are the important parts of the stored proc: ... I found that this was casued by the UPDATE statement at the end ...
    (microsoft.public.sqlserver.programming)
  • Re: RETURN_VALUES ??? done... What have I gained?
    ... b (aka whipper-snapper) ... > similar questions via stored proc and can set up a function to do the work ... >> tAdoDataSet is really easy to use. ... >> dataset even though you are pointing to a stored procedure. ...
    (borland.public.delphi.database.ado)
  • Re: RETURN_VALUES ??? done... What have I gained?
    ... Who is Doctor Codd? ... similar questions via stored proc and can set up a function to do the work ... > tAdoDataSet is really easy to use. ... > dataset even though you are pointing to a stored procedure. ...
    (borland.public.delphi.database.ado)
  • TableAdapter, INNER JOINs, stored procs, and problems with Update
    ... I have a stored procedure that uses JOINs to return columns from multiple ... I also have another stored proc that that takes a series of params ... @ac2 int, ...
    (microsoft.public.dotnet.framework.aspnet)
  • RE: Repost - Sql Server 2005 - SSIS - nbr of input cols < nbr stored proc parameters (MS
    ... proc parameters ... | file and insert them into an existing table using an 'insert stored proc' ... | inputs for all the stored proc parameters but the flat file only contains ... | and a stored procedure that inserts records into our lkp_county table ...
    (microsoft.public.sqlserver.dts)