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

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
redlake2
Posts: 4
Joined: Thu 06 Jul 2006 06:28

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

Post by redlake2 » Thu 06 Jul 2006 06:42

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();
}

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Thu 06 Jul 2006 06:51

To assign parameters of TMyStoredProc you should use something like this:

Code: Select all

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

redlake2
Posts: 4
Joined: Thu 06 Jul 2006 06:28

Syntax

Post by redlake2 » Thu 06 Jul 2006 06:59

Yes that does work thanks very much. :)

Post Reply