Add(String,MySqlType,Int32) Method
Adds a
MySqlParameter to the
MySqlParameterCollection given the the parameter name, data type, and data size.
The following example creates a
MySqlParameterCollection, adds instances of
MySqlParameter to the collection, and returns a reference to the new
MySqlParameter.
public void CreateMySqlParamColl(MySqlConnection myConn) {
MySqlCommand myCommand = new MySqlCommand("SELECT * FROM Test.Dept WHERE DeptNo = :DeptNo", myConn);
MySqlParameterCollection myParamCollection = myCommand.Parameters;
MySqlParameter myNewParameter = myParamCollection.Add("DeptNo", MySqlType.Int, 40);
}
Public Sub CreateMySqlParamColl(myConn As MySqlConnection)
Dim myCommand As MySqlCommand = New MySqlCommand("SELECT * FROM Test.Dept WHERE DeptNo = :DeptNo", myConn)
Dim myParamCollection As MySqlParameterCollection = myCommand.Parameters
Dim myNewParameter As MySqlParameter = myParamCollection.Add("DeptNo", MySqlType.Int, 40)
End Sub
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2