'Declaration Public Shadows Function CreateParameter() As MySqlParameter
public new MySqlParameter CreateParameter()
Return Value
A MySqlParameter object.
'Declaration Public Shadows Function CreateParameter() As MySqlParameter
public new MySqlParameter CreateParameter()
Public void CreateParam(MySqlConnection myConnection) { MySqlCommand myCommand = new MySqlCommand("SELECT * FROM Test.Dept WHERE DeptNo=:Deptno",myConnection); MySqlParameter myParam = myCommand.CreateParameter(); myParam.MySqlType = Devart.Data.MySql.MySqlType.Int; myParam.Value = 10; myParam.ParameterName = "Deptno"; myCommand.Parameters.Add(myParam); myConnection.Open(); MySqlDataReader myReader = null; try { myReader = myCommand.ExecuteReader(); while (myReader.Read()) { Console.WriteLine(myReader.GetInt32(0) + ", " + myReader.GetString(1) + ", " + myReader.GetString(2)); } } finally { myReader.Close(); myConnection.Close(); } }
Public Sub CreateParam(ByVal myConnection As MySqlConnection) Dim myCommand As New MySqlCommand("SELECT * FROM Test.Dept WHERE DeptNo=:Deptno", myConnection) Dim myParam As MySqlParameter = myCommand.CreateParameter() myParam.MySqlType = Devart.Data.MySql.MySqlType.Int myParam.Value = 10 myParam.ParameterName = "Deptno" myCommand.Parameters.Add(myParam) myConnection.Open() Dim myReader As MySqlDataReader = Nothing Try myReader = myCommand.ExecuteReader() While myReader.Read() Console.WriteLine(myReader.GetInt32(0).ToString() + ", " _ + myReader.GetString(1) + ", " _ + myReader.GetString(2)) End While Finally myReader.Close() myConnection.Close() End Try 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