{
#region Huynh Van Si General command
void New()
{
}
string ReturnValueParameterName = "RETURN_VALUE";
///****************************************************************
/// Class : GenerateCommand
/// Author : HUYNH V. Si
/// Created Date :
/// ***************************************************************
///
///This class is used to generate command.
///
public MySqlCommand GenerateCommand(MySqlConnection Connection, MethodInfo Method, Object[] Values)
{
MySqlCommand command = new MySqlCommand();
command.Connection = Connection;
command.CommandText = Method.Name;
command.CommandType = CommandType.StoredProcedure;
ParameterInfo[] methodParameters = Method.GetParameters();
int index = 0;
foreach (ParameterInfo paramInfo in methodParameters)
{
MySqlParameter mySqlPara = new MySqlParameter();
mySqlPara.ParameterName = paramInfo.Name;
//mySqlPara.ParameterName = mySqlPara.ParameterName;
mySqlPara.ParameterName = "?" + mySqlPara.ParameterName;
//mySqlPara.ParameterName = "@" + mySqlPara.ParameterName;
//mySqlPara.ParameterName = mySqlPara.ParameterName;
mySqlPara.Value = Values[index];
command.Parameters.Add(mySqlPara);
index++;
}
command.Parameters.Add(ReturnValueParameterName, MySqlDbType.Int64).Direction = ParameterDirection.ReturnValue;
return command;
}
#endregion
}