Recent

Author Topic: SQLite 3 --> Capture FieldValues into a variable  (Read 3984 times)

kakarotv5

  • New Member
  • *
  • Posts: 42
SQLite 3 --> Capture FieldValues into a variable
« on: November 26, 2007, 01:16:32 pm »
Hi, I need to capture the FieldValues of a SQLite database into a string variable.

If I do it:

Code: [Select]

   while not dsTest.EOF do
    begin
     DataToSend := DataToSend +
                            dsTest.FieldValues['Code'] + '\' +
                            dsTest.FieldValues['Name'] + '\' +
                            dsTest.FieldValues['Address'] + '#';
     dsTest.Next;
    end;    


I have got the next error message:

Code: [Select]

Project raised exception class 'RunError(231)'.


If I do it then works:

Code: [Select]

   while not dsTest.EOF do
    begin
     Cod := dsTest.FieldValues['Code'];
     Nam := dsTest.FieldValues['Name'];
     Addr := dsTest.FieldValues['Address'];
     DataToSend := DataToSend + Cod + '\' + Nam + '\' + Addr + '#';
     dsTest.Next;
    end;    


But I have to declare three string variables (Cod, Nam and Addr). :?

Can you help me?
I have installed:
Lazarus-0.9.23-fpc-2.1.5-win32
Lazarus-0.9.23-fpc-2.1.5-cross-arm-wince-win32

I do not have a PDA but I use the Microsoft Windows Mobile 5.0 MSFP Emulator Images and Microsoft Windows Mobile 6 Emulator

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2515
RE: SQLite 3 --> Capture FieldValues into a variable
« Reply #1 on: November 26, 2007, 02:06:12 pm »
You are concatinating variants, that isn't very well tested.
You can also try:
Code: [Select]

  ...
  dsTest.FieldByName('Code').AsString + '\' +
  dsTest.FieldByName('Name').AsString + '\' +
  dsTest.FieldByName('Address').AsString + '#';
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

kakarotv5

  • New Member
  • *
  • Posts: 42
RE: SQLite 3 --> Capture FieldValues into a variable
« Reply #2 on: December 12, 2007, 03:38:37 pm »
Thank you.
I have installed:
Lazarus-0.9.23-fpc-2.1.5-win32
Lazarus-0.9.23-fpc-2.1.5-cross-arm-wince-win32

I do not have a PDA but I use the Microsoft Windows Mobile 5.0 MSFP Emulator Images and Microsoft Windows Mobile 6 Emulator

 

TinyPortal © 2005-2018