[thelist] returning output from MSSQL to vbscript

Ken Schaefer Ken at adOpenStatic.com
Tue Apr 18 18:33:10 CDT 2006

:  -----Original Message-----
:  From: thelist-bounces at lists.evolt.org [mailto:thelist-
:  bounces at lists.evolt.org] On Behalf Of Canfield, Joel
:  Sent: Wednesday, 19 April 2006 7:22 AM
:  To: thelist at lists.evolt.org
:  Subject: Re: [thelist] returning output from MSSQL to vbscript
:  > cmd.parameters.append cmd.createparameter("@intIDOut", adInteger,
:  > adParamOutput, oVal)
:  > Response.Write "@intIDOut = " & cmd.parameters("@intIDOut").value
:  huh. thanks.
:  so, is using ADODB.Command the only way to get the output value? I've
:  never used it, which is probably why I wasn't having much success.

Hi Joel,

There is some sample code you can use here:

(it shows how you can return a recordset and output parameters, but you can
just drop the recordset bit if you're only returning parameters)

I agree with Matt Warden about using Command objects. After you start using
them, they become second nature and you don't really go back. The added
benefit of using Command/Parameters objects is that SQL Injection attacks are
defeated by ADO - there is nothing that you need to do.

I disagree with Scott about how "different" they are. Personally I don't
really recommend returning single record, single column recordsets. There is
additional overhead in doing things this way, and you don't really save
anything in terms of LoC. Given that a good ASP page would have all its data
allocated to local variables or arrays before you get to the HTML bit, I
don't really see any difference between populating those local variables with
Command objects, or with Recordset objects. There is no inherent benefit that
I can see to using Recordsets as Scott has argued.


My IIS Blog: www.adOpenStatic.com/cs/blogs/ken
Tech.Ed Boston 2006 See you there: Everything the web administrator needs to
know about MOM 2005

More information about the thelist mailing list