Wrox Programmer Forums
|
BOOK: VBScript Programmer's Reference, 1st, 2nd, and 3rd editions
This is the forum to discuss the Wrox book VBScript Programmer's Reference, 3rd Edition by Adrian Kingsley-Hughes, Kathie Kingsley-Hughes, Daniel Read; ISBN: 9780470168080
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: VBScript Programmer's Reference, 1st, 2nd, and 3rd editions section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 19th, 2004, 05:40 PM
Registered User
 
Join Date: Mar 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default ADO Command Object with Parameters

I'm writing a VBScript program to read a text file and pass the text record to the database to update tables. A stored procedure will parse the text and update the tables. After the text record is processed, the stored procedure (or function) will return a value to the VBScript program. Based on the return value, I'll know if the input record needs to be corrected and resubmitted. This is a batch job. I'd like to pass two parameters to the database. The first would contain the text record. The second would be used for a return value from the stored procedure or function. I don't need to get a recordset back. I just need a message telling me if errors were found or if the job was completed successfully.
I've tried sending two parameters, one as input with the text needed for the select statement, and the other as output (which didn't work) and return value (which didn't work either).
Here are my questions:
What is the correct way for setting up and using these parameters? What are the values of the parameter attributes that I need to send for each parameter?
Is it possible to get back a parameter (return value) that is not in the form of a recordset?
Is there a way of sending the command to execute a function instead of a stored procedure? There doesn't appear to be a CommandType for a function. Can I use adCmdStoredProc for a function?
Must the recordset be associated with a table? Can it be associated with a view?




 
Old March 19th, 2004, 09:38 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Is this a SQL Server database? I'm basing my response from a SQL Server database perspective. You can return a parameter. SQL Server has a keyword "OUTPUT". For the parameter, you can specify that the parameter direction be output instead of input (default). If you need to return an integer value, SQL Server has this by default (@RETURN_VALUE), which you return a value by "return <number>" in the stored procedure. If a stored procedure, the command type must be adCmdStoredProc (4).

You can associate a recordset with a view; the recordset doesn't care what the source is as long as it returns record data, which a view does.

Hope this helps,

Brian Mains
 
Old March 24th, 2004, 09:27 AM
Registered User
 
Join Date: Mar 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Brian,
Thanks for your help.
Everything is working like a charm!
Barbara Heidecker






Similar Threads
Thread Thread Starter Forum Replies Last Post
Command text was not set for the command object Sheraz Khan Classic ASP Databases 2 May 29th, 2007 12:57 AM
Issues with Command Object and Parameters BSkelding Crystal Reports 0 May 2nd, 2007 10:29 AM
Syntax for OleDb Command Object Parameters aadz5 ASP.NET 1.0 and 1.1 Basics 4 November 20th, 2003 03:31 PM
trouble w/ command object and parameters RbH All Other Wrox Books 0 August 5th, 2003 12:31 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.