[AccessD] Adding ADODB parameters

James Barash James at fcidms.com
Tue Jun 1 16:28:02 CDT 2004


JR:

Try com3.Parameters("@CV").Value + com3.Parameters("@CP").Value + ...

You might also want to wrap each one in an nz() function if it is possible
for one or more parameters to be Null.

James Barash

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Joe Rojas
Sent: Tuesday, June 01, 2004 3:35 PM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] Adding ADODB parameters

Hi All,

Using an ADO command object to retrieve information from a SQL Server 7
stored procedure.
The command object has 3 OUTPUT parameters used to retrieve 3 values from
the stored procedure.

The command object parameters are set up as follows:
...
com3.Parameters.Append com3.CreateParameter("@CV", adDecimal, adParamOutput)
com3.Parameters("@CV").Precision = 10
com3.Parameters("@CV").NumericScale = 4

 com3.Parameters.Append com3.CreateParameter("@CP", adDecimal,
adParamOutput)
com3.Parameters("@CP").Precision = 10
com3.Parameters("@CP").NumericScale = 4

com3.Parameters.Append com3.CreateParameter("@SV", adDecimal, adParamOutput)
com3.Parameters("@SV").Precision = 10
com3.Parameters("@SV").NumericScale = 4
...

Precision and scale are set exactly the same as the stored procedure, which
is setup exactly the same as the table.

The SP runs perfectly. If I check the values in the parameters after the SP
runs, I get the desired values.

The problem is that if I tried to perform the calculation:
com3.Parameters("@CV") + com3.Parameters("@CP") + com3.Parameters

I get a type mismatch error. If I cast all 3 parameters to type Double
before the calculation, it works fine.

Can I not do this?

Thanks
JR



This electronic transmission is strictly confidential to TNCO, Inc. and
intended solely for the addressee. It may contain information which is
covered by legal, professional, or other privileges. If you are not the
intended addressee, or someone authorized by the intended addressee to
receive transmissions on behalf of the addressee, you must not retain,
disclose in any form, copy, or take any action in reliance on this
transmission. If you have received this transmission in error, please notify
the sender as soon as possible and destroy this message. While TNCO, Inc.
uses virus protection, the recipient should check this email and any
attachments for the presence of viruses. TNCO, Inc. accepts no liability for
any damage caused by any virus transmitted by this email.
-- 
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list