none
DBCommand and parameter sequence RRS feed

  • Question

  • I have a SP with 1 mandatory parameter and 2 optional parameter
    I am using dbcommand to execute it.

    On conditions I am trying to pass the optional parameters as named parameter
    but it is not recognizing the named parameter and it always take the sequence one



    • Moved by Chris Robinson- MSFT Friday, February 27, 2009 6:19 PM Stored Procedure question (Moved from ADO.NET DataSet to ADO.NET Data Providers)
    Friday, February 27, 2009 2:03 PM

All replies

  • This would be true if you are using the OLEDB library. The OLEDB library does not support named parameters. Parameters are resolved based upon their ordinal position in the collection.
    Paul ~~~~ Microsoft MVP (Visual Basic)
    • Proposed as answer by CrowKing Sunday, March 1, 2009 6:22 AM
    Friday, February 27, 2009 6:26 PM
  • Which provider are you using to connect to database? In a case of .NET Managed provider for SQL Server or Oracle you should be able to use named parameters. In a case of OLEDB provider, you will need to pass parameters in same order as they appear in your SP.
    Val Mazur (MVP) http://www.xporttools.net
    Tuesday, March 3, 2009 11:12 AM
    Moderator