What do you think after reading this? About type conversion in Delphi ?? Delphi/Windows SDK/API
Http://www.delphi2007.net/DelphiBase/html/delphi_20061215172228146.html
Inttostr (ABS (strtoint (booltostr (iadoquery. fieldvalues ['ifaccept '])
Because the ifaccept field is of the bit type, if the value in the database is 1, I want to use the conversion method to get 1 instead of using if for determination, finally, I wrote a bunch Code !!
Is there a simpler way ?? The overall feeling is that the type conversion Review of Delphi is too strict. I don't want to use it in C ++ builder !!
What's more strange is that if the booltostr function contains 1, the return value is-1. I really don't understand why does Borland's engineer directly give 1?
What do you think.
Iadoquery. fieldvalues ('ifaccept '). asstring
Or
Inttostr (ord (iadoquery. fieldvalues ('ifaccept '). asboolean ))
You can only say that your code is imaginative!
Setlength (trueboolstrs, 1 );
Setlength (falseboolstrs, 1 );
Trueboolstrs [0]: = '1 ';
Falseboolstrs [0]: = '0 ';
Booltostr (iadoquery. fieldvalues ('ifaccept '). asboolean, true );