Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Wrox Announcements and Feedback > All Other Wrox Books
|
All Other Wrox Books Do you have a question about a Wrox book that isn't listed anywhere on p2p.wrox.com or where the forum is locked? Here's a forum to post questions about any other Wrox book so that other readers or one of the authors can help you with your questions. IF YOU ARE LOOKING FOR CODE DO NOT ASK "Where can I find the code for this book?" That question is answered here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the All Other Wrox Books 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
  #1 (permalink)  
Old August 5th, 2003, 12:31 PM
RbH RbH is offline
Registered User
 
Join Date: Aug 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default trouble w/ command object and parameters

I was reading in ch 7 of Professional ASP Data Access about using input and output parameters with the command object and an MS SQL Server stored proc. I'm having some trouble. The first code block below always passes null values for the two input parameters to the stored proc - even when a literal value is hard coded in. The second says there are to many parameters for the stored proc. I've also included the beginning of the stored proc for reference.

---code block one---
With Cmd
  .ActiveConnection=Conn
  .CommandText="_spTest"
  .CommandType=adCmdStoredProc
  Set P= .Parameters
  P.Append .CreateParameter("@Email",adVarChar,adParamInput,5 0)
  P.Append .CreateParameter("@fName",adVarChar,adParamInput,5 0)
  P.Append .CreateParameter("@uID",adInteger,adParamOutput,4)
  Cmd("@Email")="me@you.net"
  Cmd("@fName")="Ryan"
  .Execute
End With

---code block two---
With Cmd
  .ActiveConnection=Conn
  .CommandText="_spTest"
  .CommandType=adCmdStoredProc
  Set pEmail= .CreateParameter("@Email",adVarChar,adParamInput,5 0)
  Set pFname= .CreateParameter("@fName",adVarChar,adParamInput,5 0)
  Set pUserID= .CreateParameter("@uID",adInteger,adParamOutput,4)
  pEmail.Value="userOne@you.net"
  pFname.Value="User"
  .Parameters.Append pEmail
  .Parameters.Append pFname
  .Parameters.Append pUserID
  .Execute
End With

---stored proc---
CREATE PROCEDURE _spTest
(
@Email varchar(50),
@fName varchar(50),
@uID int OUTPUT
)
As
...

I've also tried this:
.CreateParameter("@Email",adVarChar,adParamInput,5 0,value)
where "value" is a variable or a hard coded value and it still always passes NULL to the stored proc.

Any thoughts?

Thanks a lot - Ryan





Similar Threads
Thread Thread Starter Forum Replies Last Post
Issues with Command Object and Parameters BSkelding Crystal Reports 0 May 2nd, 2007 10:29 AM
Command text was not set for the command object. deepa12 BOOK: Beginning ASP 3.0 5 November 2nd, 2004 05:37 PM
Syntax for OleDb Command Object Parameters aadz5 ASP.NET 1.0 and 1.1 Basics 4 November 20th, 2003 03:31 PM





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