SqlParameterCollection::AddWithValue Method (String^, Object^)
Adds a value to the end of the SqlParameterCollection.
Assembly: System.Data (in System.Data.dll)
Parameters
- parameterName
-
Type:
System::String^
The name of the parameter.
- value
-
Type:
System::Object^
The value to be added. Use DBNull::Value instead of null, to indicate a null value.
AddWithValue replaces the SqlParameterCollection.Add method that takes a String and an Object. The overload of Add that takes a string and an object was deprecated because of possible ambiguity with the SqlParameterCollection.Add overload that takes a String and a SqlDbType enumeration value where passing an integer with the string could be interpreted as being either the parameter value or the corresponding SqlDbType value. Use AddWithValue whenever you want to add a parameter by specifying its name and value.
For SqlDbTypeXml enumeration values, you can use a string, an XML value, an XmlReader derived type instance, or a SqlXml object.
Available since 2.0