System.Data.SqlClient Namespace SqlParameterCollection Class
Returns the SqlParameter at the specified index.
SqlParameter variable = SqlParameterCollection.Item [ index ];
... or ...
SqlParameter variable = SqlParameterCollection [ index ];
dim variable as SqlParameter = SqlParameterCollection.Item ( index )
... or ...
dim variable as SqlParameter = SqlParameterCollection ( index )
variable : SqlParameter = SqlParameterCollection.Item ( index );
... or ...
variable : SqlParameter = SqlParameterCollection ( index ); |
|
C# |
VB |
JScript |
- index
- The zero-based index of the parameter to retrieve.
The SqlParameter at the specified index.
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 );
}
Public Sub CreateSqlParamColl ( myCmd As SqlCommand )
Dim myParams As SqlParameterCollection = myCmd.Parameters
Dim myParamNames As String = ""
Dim i As Integer
For i = 0 To myParams.Count - 1
myParamNames += myParams ( i ).ToString ( ) + ControlChars.Cr
Next i
MessageBox.Show ( myParamNames )
End Sub |
|
C# |
VB |
SqlParameterCollection Members SqlParameterCollection.Item Overload List