MimerCommand command = new MimerCommand();
//
// Perform insert with named parameters.
//
command.CommandText = "INSERT INTO TAB VALUES(:c1,:c2);"
command.Parameters.Add("c2", "bar");
command.Parameters.Add("c1", "foo");
// The above code will match the parameter names and do the following:
// INSERT INTO TAB VALUES('foo','bar');
//
// Perform insert with named parameters that do not match.
//
command.CommandText = "INSERT INTO TAB VALUES(:c1,:c2);"
command.Parameters.Add("c3", "bar");
command.Parameters.Add("c4", "foo");
// The above code will fail to match the parameter names and do the following:
// INSERT INTO TAB VALUES('bar','foo');
// as unnamed parameters are read from the collection in the order they appear.
//
// Perform insert with unnamed parameters.
//
command.CommandText = "INSERT INTO TAB VALUES(?,?);"
command.Parameters.Add("", "foo");
command.Parameters.Add("", "bar");
// The above code will read the parameter collection in the order the parameters appear:
// INSERT INTO TAB VALUES('foo','bar');
//
// Perform insert with parameters with a specific position.
//
command.CommandText = "INSERT INTO TAB VALUES(:2,:1);"
command.Parameters.Add("", "bar");
command.Parameters.Add("", "foo");
// The above code will read the parameter collection in the order specified in the command text:
// INSERT INTO TAB VALUES('foo','bar');