AspNet.sk     Diskusné fóra     Vitajte v QuickStarts     ASP.NET     Silverlight     Ako môžem...? (en)     Class prehliadač Príklady chcem v ...   
Menu
Skip Navigation Links.

How Do I...? Common Tasks QuickStart Tutorial

ADO.NET: Get Out Parameters from a Stored Procedure



Some stored procedures return values through parameters. When a parameter in a SQL statement or stored procedure is declared as "out", the value of the parameter is returned back to the caller; the value is stored in a parameter in the Parameters collection on the OleDbCommand or SqlCommand objects.

Unlike the sample below, if the connection and command name are not set, you can still establish the parameters, but you have to create the collection of parameters and expected types.


    workParam = myCommand.Parameters.Add("@CustomerID", SQLDataType.NChar, 5)
    workParam.Value = "CUSTID"
    
VB


The following sample shows how to use a stored procedure that returns output parameters. The command is executed to create a stored procedure in the Northwind database.

VB OutParamsWithACommand.aspx
Run Sample View Source





Microsoft .NET Framework SDK QuickStart Tutorials Version 2.0
Copyright � 2005 Microsoft Corporation. All rights reserved.


Microsoft .NET Framework SDK QuickStart Tutorials Version 2.0
Copyright © 2005 Microsoft Corporation. All rights reserved.
Preklad do slovenského jazyka - Copyright © 2005 - 2007 www.aspnet.sk, www.qsh.sk
Pošlite komentár k tejto stránke
Copyright © 2002 - 2008 Chastia, spol. s r. o., Igor Stanek, Designed by Lacino
Portál je hostovaný na serveroch firmy Quantasoft - www.qsh.sk.