[Lazarus] Generate a string with a record of SQLite3 database

Joost van der Sluis joost at cnoc.nl
Wed Oct 1 22:40:23 CEST 2008


Op woensdag 01-10-2008 om 17:06 uur [tijdzone +0200], schreef Usuario
AnĂ³nimo:
> sequence := Db.FieldValues['Code'] + '#' +
>                    Db.FieldValues['Proveedor'] + '#' +
>                    Db.FieldValues['Almacen'] + '#' +
>                    Db.FieldValues['Unidades'];

Please don't use the FieldValues property. I didn't even knew that
property existed until recently. But afaik your code should work with
fpc 2.2.2 or maybe 2.3.1. If not, please create a bug-report.

But in the general case, use Db.FieldByName('Proveedor').AsString.
That's faster and you avoid the use of variants. If you do need a
variant, use Db.FieldByName.Value.

> I want something like this:
>  
> for i:= 1 to Db.FieldCount do
>   Db.FieldValues[i];


for i := 0 to Db.Fieldcount -1 do
  writeln(db.fields[0].AsString);

Joost




More information about the Lazarus mailing list