Add(String,MySqlType) Method
Adds a
MySqlParameter to the
MySqlParameterCollection given the parameter name and data type.
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;
object myParm = new MySqlParameter("DeptNo", MySqlType.Int);
int pIndex = myParamCollection.Add(myParm);
}
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 myParm As Object = New MySqlParameter("DeptNo", MySqlType.Int)
Dim pIndex As Integer = myParamCollection.Add(myParm)
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