Page 1 of 1

Syntax for Using TMyStoredProc (Borland C++ 2006 - MySql)

Posted: Thu 06 Jul 2006 06:42
by redlake2
I can't figure out the syntax to change the parameter value for my stored procedure.If I set the property value as 'cat' on the object itself it works, but i want to be able to change the input parameter from 'cat' to 'dog' in the code so that I am only using one TMyStoredProc Object.

The code below doesn't work because I can't figure out how to access the Params value, hence compile error (value is not a member of TDAParams). I have tried creating a TParams object and adding the values to that but that didn't work either. I have checked the help and there are no examples. Any ideas?

void __fastcall TForm1::btnCatsClick(TObject *Sender)
{
// Filter to show only cats
MyStoredProc->Params->value = "cat";
MyStoredProc->Execute();
}
//-------------------------------------
void __fastcall TForm1::btnDogClick(TObject *Sender)
{
// Filter to show only dogs
MyStoredProc->Params.Value = "dog";
MyStoredProc->Execute();
}

Posted: Thu 06 Jul 2006 06:51
by Antaeus
To assign parameters of TMyStoredProc you should use something like this:

Code: Select all

MyStoredProc->ParamByName("Param_Name")->AsString = "Param_Value";

Syntax

Posted: Thu 06 Jul 2006 06:59
by redlake2
Yes that does work thanks very much. :)