Subject | RE: [IBO] Params in BCB |
---|---|
Author | Norman Dunbar |
Post date | 2003-02-18T10:18:52Z |
Helen wrote :
(in triplicate) before it will do anything :o)
The params are TIB_Row and not TStrings, so the following won't compile. It
fails with the error Strings is not a member of TIB_Row :
more readable and thus maintainable - even if it is supposed to be slower.
as in :
IB_Query1->ParamByName("MDA_ID")->AsInteger = StrToInt(Edit1->Text);
However, I did a bit of investigating and wandering through the help file
and found out that it translates to the following if you want to use the
Params property :
IB_Query1->Params->Columns[0]->AsInteger = StrToInt(Edit1->Text);
I think I prefer Delphi's habit of letting you get at default properties !
Similarly, getting at the Fields properties of a query is almost identical :
ShowMessage(IB_Query1->Fields->Columns[1]->AsString);
Hope this helps.
Regards,
Norman.
-------------------------------------
Norman Dunbar
Database/Unix administrator
Lynx Financial Systems Ltd.
mailto:Norman.Dunbar@...
Tel: 0113 289 6265
Fax: 0113 289 3146
URL: http://www.Lynx-FS.com
-------------------------------------
This email is intended only for the use of the addressees named above and
may be confidential or legally privileged. If you are not an addressee you
must not read it and must not use any information contained in it, nor copy
it, nor inform any person other than Lynx Financial Systems or the
addressees of its existence or contents. If you have received this email
and are not a named addressee, please delete it and notify the Lynx
Financial Systems IT Department on 0113 2892990.
>> Isn't the problem that BCB doesn't recognise default properties?That's exactly what is happening, the old C++ needs everything spelled out
(in triplicate) before it will do anything :o)
>> I think with a TStrings, you need to specify the Strings[n] propertyexplicitly, e.g.
The params are TIB_Row and not TStrings, so the following won't compile. It
fails with the error Strings is not a member of TIB_Row :
>> Query1->Params->Strings[0]->AsString = "hello"I tend to use is ParamByName() almost for everything I do as it is a bit
more readable and thus maintainable - even if it is supposed to be slower.
as in :
IB_Query1->ParamByName("MDA_ID")->AsInteger = StrToInt(Edit1->Text);
However, I did a bit of investigating and wandering through the help file
and found out that it translates to the following if you want to use the
Params property :
IB_Query1->Params->Columns[0]->AsInteger = StrToInt(Edit1->Text);
I think I prefer Delphi's habit of letting you get at default properties !
>> Sorry, can't test it, as I don't have BCB.No worries, I've tested the above and both work exactly the same.
Similarly, getting at the Fields properties of a query is almost identical :
ShowMessage(IB_Query1->Fields->Columns[1]->AsString);
Hope this helps.
Regards,
Norman.
-------------------------------------
Norman Dunbar
Database/Unix administrator
Lynx Financial Systems Ltd.
mailto:Norman.Dunbar@...
Tel: 0113 289 6265
Fax: 0113 289 3146
URL: http://www.Lynx-FS.com
-------------------------------------
This email is intended only for the use of the addressees named above and
may be confidential or legally privileged. If you are not an addressee you
must not read it and must not use any information contained in it, nor copy
it, nor inform any person other than Lynx Financial Systems or the
addressees of its existence or contents. If you have received this email
and are not a named addressee, please delete it and notify the Lynx
Financial Systems IT Department on 0113 2892990.