I have a TADOStoredProc with one parameter being a float. This parameter is designated as type ftFloat in the Object Inspector so Delphi is recognizing the SQL sp correctly.
I have a string value that I want to assign to the Float parameter. My syntax is:
TADOStoredProc1.Parameters.ParamByName('@fltTest').AsString := 'AString'
This line produces a compiler error: 'Undeclared Identifier: AsString'. 'AsString' (or any such cast) does not appear to be a valid procedure for a TADOStoredProc component. (Also in the code I have variable assignations to TADOQuery results which are fine--'tVariable := ADOqry1Field1.AsString' is OK.)
I have used similar stored procedure syntax in the past with the BDE stored procedure component (TStoredProc) and have not had a problem.
I know that I can work around it by casting the value being assigned to the parameter e.g.:
TADOStoredProc1.Parameters.ParamByName('@fltTest').Value := StrToFloat('AString')
However, I would prefer not to use that method because I think (and please correct if I'm wrong)
1. Using '.Value' leaves that Parameter type a Variant until it's assigned at runtime (less efficient)
2. Casts of 'StrTo...' etc. require involving TFormatSettings
I really *really* don't want to just set the .Value to 'AString' and hope Delphi converts automatically.
I would really appreciate any assistance with this problem. Thanks!
0 · ·