asp.net.ph

SqlParameterCollection.Item Property ( Int32 )

System.Data.SqlClient Namespace   SqlParameterCollection Class


Returns the SqlParameter at the specified index.

Syntax


SqlParameter variable = SqlParameterCollection.Item [ index ];
... or ...
SqlParameter variable = SqlParameterCollection [ index ];
  C# VB JScript

Parameters

index
The zero-based index of the parameter to retrieve.

Property Value

The SqlParameter at the specified index.

Exceptions


Exception Type Condition
IndexOutOfRangeException Occurs when the specified index does not exist.

Example

The following example shows use of the Item property to display the name of each SqlParameter object in a given SqlParameterCollection.

public void CreateSqlParamColl ( SqlCommand myCmd ) {
   SqlParameterCollection myParams = myCmd.Parameters;
   string myParamNames = "";

   for ( int i=0; i < myParams.Count; i++ ) {
      myParamNames += myParams [ i ].ToString ( ) + "\n";
   }
   MessageBox.Show ( myParamNames );
}
  C# VB

See Also

SqlParameterCollection Members   SqlParameterCollection.Item Overload List Skip Navigation Links




Previous page Back to top Next page

Check out related books at Amazon

© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note