Page 1 of 1

Where is the method ParamByName from MySqlCommand

Posted: Mon 02 Apr 2012 06:46
by Thomas J.
Hello all,

in C++ (VCL) I'm using TMyQuery to process SQL commands and the method ParamByName to access the parameters.
I cannot find the method.
Only the simple index method like

Code: Select all

sqlCommand.Parameters[0].Value = 60;
Thanks
Thomas

Posted: Tue 03 Apr 2012 11:38
by Pinturiccio

Code: Select all

MySqlCommand comm = new MySqlCommand();
comm.Parameters; //returns the MySqlParameterCollection object for the corresponding MySqlCommand object.
If you want to get access to a parameter from the MySqlParameterCollection class by the parameter name, then you should use index with this name. The index is overloaded in the MySqlParameterCollection class.
Let's consider that you have the MySqlCommand comm variable with the parameter "param". Then you can get access to this parameter as shown in the following code:

Code: Select all

comm.Parameters["param"].Value = 60;
For more information, please refer to:
http://www.devart.com/dotconnect/mysql/ ... ng%29.html
http://www.devart.com/dotconnect/mysql/ ... eters.html