Results 1 to 3 of 3

Thread: optional parameter command object

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2001
    Location
    Bradenton, FL
    Posts
    87

    optional parameter command object

    Using the ADO DataEnvironment... How do I get the optional parameters for a command object to work? I went to the Properties of the command object and named my parameters.. then set required to false and put a value there (basically, the default... this is what MSDN says to do).. but in code, if i dont pass one of the optional parameters, i get an error stating that the required paremeters have not been passed. Is there maybe a placeholder that I need to be using here in my call to the command object..

    Help please
    -gb

  2. #2
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744
    Optional parameters exist in the Stored Procedure where you can set it up:
    Code:
    CREATE PROCEDURE TestProc (@IDCol varchar(11) = NULL) AS
             --If you don't pass the parameter it will be considered as NULL
             IF @IDCol = NULL
                select count(au_id) from authors
             ELSE
                select count(au_id) from authors where au_id = @IDCol

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jan 2001
    Location
    Bradenton, FL
    Posts
    87
    this holds true for stored procedures, but what about command objects in the dataenvironment?

    In addition to being null if it is not passed to the procedure, can you set a default value other than null.. say a wildcard like %?

    Thanks for your response
    -gb

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width