Recent

Author Topic: Extracting the contents of a record's field.  (Read 11517 times)

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Extracting the contents of a record's field.
« Reply #15 on: April 15, 2013, 07:05:22 am »
Strange.

Did
- an sql query
- bound to the existing ibconnection+transaciton
- not bound to the datasource
not work?

Having the lookup query in the same transaction as the grid lets it show the same data...
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

Pascaluvr

  • Full Member
  • ***
  • Posts: 216
Re: Extracting the contents of a record's field.
« Reply #16 on: April 17, 2013, 11:36:07 am »
cov,

I am a newbie also and just learning this stuff by trial and error - so  what I say may be wrong (or inefficient) but it works for me:

1.  You only need one Transaction (I don't know about other dbms, but sqlite will not allow a transaction within a transaction.    So far, i have not  found a need for a 2nd Transaction)

2.  To access the a second 'select' without losing the first, you not only need a 2nd Query, but also a 2nd Datasource (and prossibly a 2nd DBgrid to display it).

3.  Since you need to access columns that you don't want displayed, simply:
Code: [Select]
        DBGrid1.Columns[x].Visible := False; 
(where x= column not to be displayed but you still wish to access, x=0 is first column)

Hope this helps
« Last Edit: April 17, 2013, 11:38:51 am by Pascaluvr »
Windows 7, Lazarus 1.0.8, FPC 2.6.2, SQLite 3

teos

  • Full Member
  • ***
  • Posts: 161
Re: Extracting the contents of a record's field.
« Reply #17 on: April 18, 2013, 05:50:25 pm »
I wonder if using a second sqlquery component would work (with its own datasource and dbgrid) and using the afterscroll event to fill parameters of a second sqlquery which is then opened. (would give the right record and also only records required).

A pitty that master-detail is not implemented which would handle that on the fly.

b.t.w.: I think that ZTable with use of master-detail could be easier..

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

teos

  • Full Member
  • ***
  • Posts: 161
Re: Extracting the contents of a record's field.
« Reply #19 on: April 19, 2013, 11:06:28 am »
Okay.. missed it. But nevertheless the link provides a perfect answer.

cov

  • Full Member
  • ***
  • Posts: 246
Re: Extracting the contents of a record's field.
« Reply #20 on: April 19, 2013, 11:08:45 pm »
Thank you.

I'll look at that.

 

TinyPortal © 2005-2018