Appearance
Field.AsSQL
Declaration
property AsSQL: string;
Example
pascal
procedure OnMapEvent(var Value:Variant);
begin
Value := Dataset['myfield'].AsSQL; //the value of myfield for use with SQL
end;Description
Returns the value of the Field object as a String (String, Widestring) formatted for use with a SQL Statement. If the field is null then a blank string or zero is returned depending on whether the field is a string or numeric data type.
When the field represents a string data type the value will be returned appropriately enclosed within quotes (the quote type is depending on the database being accessed). When the field represents a numeric data type the value will be returned as is. When the field represents a datetime data type the value will be returned appropriately formatted for the database in question.
It is recommended that you use this property when referencing fields for inclusion in SQL statements built within the script eg GetDataSetFromSource.