PreviousNext
Help > Easycom .NET > System.Data.EasycomClient namespace > EacCommand > EacCommand methods > EacCommand.Prepare()
EacCommand.Prepare()

 

public void Prepare ( )

 

Explicitly prepares the command. This is useful to validate the "Parameters" collection. Prepare is designed to be called only once for a given EacCommand object.

One call of Prepare() method can be used before multiple calls of ExecuteReader() or ExecuteNonQuery() methods.

 

 

Example (C#):

                        String data[] = new string[2];

                       data[0] = “param”;

                       data[1] = “param2”;

     EacCommand cmd = this.oCnx.CreateCommand();

           cmd.CommandText = “SELECT * FROM Table”;

           cmd.Prepare();

 

           for (int i = 0; i < data.Length; i++)

           {

EacParamter param = new EacParamter ("param" + i.ToString(), data[i]);

                    cmd.Parameters[param.ParameterName] = param;

           }

 

           cmd.ExecuteNonQuery();