MySQL Connector/Net
MySqlCommandPrepare Method |
Creates a prepared version of the command on an instance of MySQL Server.
Namespace: MySql.Data.MySqlClient
Assembly: MySql.Data (in MySql.Data.dll) Version: 6.9.9

public override void Prepare()
Public Overrides Sub Prepare
public: virtual void Prepare() override
abstract Prepare : unit -> unit override Prepare : unit -> unit
Implements
IDbCommandPrepare
Prepared statements are only supported on MySQL version 4.1 and higher. Calling prepare while connected to earlier versions of MySQL will succeed but will execute the statement in the same way as unprepared.

The following example demonstrates the use of the Prepare method.
private void PrepareExample() { MySqlCommand cmd = new MySqlCommand("INSERT INTO mytable VALUES (@val)", myConnection); cmd.Parameters.Add( "@val", 10 ); cmd.Prepare(); cmd.ExecuteNonQuery(); cmd.Parameters[0].Value = 20; cmd.ExecuteNonQuery(); }
public sub PrepareExample() Dim cmd as New MySqlCommand("INSERT INTO mytable VALUES (@val)", myConnection) cmd.Parameters.Add( "@val", 10 ) cmd.Prepare() cmd.ExecuteNonQuery() cmd.Parameters(0).Value = 20 cmd.ExecuteNonQuery() end sub
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
