Hi folks
 
Anyone got any pointers as to how to access the contents of bytes fields using parameterised queries.
 
Currrently I am using Variant arrays and binding them directly to the parameter (no AsBytes :-(  ) but I am not convinced all is as it should be - sometimes I end up with no data being stored although the normal fields are all OK.
 
Code is like :-
 
ParamByName('RTU_ID').AsSmallInt := ID;
ParamByName('CRC_Errors').AsSmallInt := ErrsCRC;
ParamByName('No_Responses').AsSmallInt := ErrsReply;
with ParamByName('Battery_Data') do
begin
    V := VarArrayCreate([0,199],varByte);
    for I := 0 to 199 do
        if not Odd(I) then
        begin
            V[I] := HiByte(Battery[I DIV 2]);
            V[I+1] := LoByte(Battery[I DIV 2]);
        end;
    DataType := ftBytes;
    Value := V;
    Bound := True;
end;
 
Any help appreciated.
 
Paul Lowman
software/hardware developer
Lowman Consulting

Reply via email to