Recent

Author Topic: SQLite - DBGrid - text field is memo  (Read 15023 times)

Milsa

  • Sr. Member
  • ****
  • Posts: 323
SQLite - DBGrid - text field is memo
« on: September 24, 2013, 03:51:40 pm »
I connected to SQLite database and set SQLQuery. Output is in DBGrid. Text field I see as "(Memo)".

This isn't for Lazarus, because I can't define events for GetText in IDE (fields haven't events):
http://stackoverflow.com/questions/4809298/lazarus-dbgrid-showing-memo-as-the-value-of-string-fields-in-sqlite-3

This tutorial is not about reality (memo problem isn't there :o ):
http://alevel-computing.x10.mx/mw/index.php/Tutorial_DBGrid

How can I fix this problem? I want to see text from database.
I work with Lazarus 2.2.2, FPC 3.2.2, date 2022-05-15
This information is actual to: 28st Dec 2022

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: SQLite - DBGrid - text field is memo
« Reply #1 on: September 24, 2013, 04:04:30 pm »
Answered already on the forum and the wiki page on grids...
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

Milsa

  • Sr. Member
  • ****
  • Posts: 323
Re: SQLite - DBGrid - text field is memo
« Reply #2 on: September 24, 2013, 04:47:12 pm »
Thank you very much. I searched with Google and I found wiki grid reference page but it didn't help me. After your reply I found with search on this forum this thread http://forum.lazarus.freepascal.org/index.php /topic,19339.msg110012.html#msg110012 with solution. Then I found it in grid reference page. Please add information about SQLite and memo to this wiki page for Google and add GetText procedure (solution is not complete on wiki page).
I work with Lazarus 2.2.2, FPC 3.2.2, date 2022-05-15
This information is actual to: 28st Dec 2022

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: SQLite - DBGrid - text field is memo
« Reply #3 on: September 24, 2013, 04:55:54 pm »
If you miss info on the wiki, you're welcome to add it.
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

ddimov007

  • Newbie
  • Posts: 5
Re: SQLite - DBGrid - text field is memo
« Reply #4 on: March 08, 2017, 12:13:10 pm »
Old thread, however, it might be helpful to elaborate on the discussion above. The link in question above that can help fight the issue of having no GetText event on DBGrid is:

http://forum.lazarus.freepascal.org/index.php/topic,19339.msg110012.html#msg110012

It works!

Hemptwister

  • Newbie
  • Posts: 2
Re: SQLite - DBGrid - text field is memo
« Reply #5 on: March 23, 2023, 10:15:14 pm »
DBGrid now has an option to display memo as text.   DisplayMemoText
It uses this code:
    if CheckDisplayMemo(aField) then
        Result := aField.AsString
Btw, the CAST(field as varchar) in your query no longer works. Nor changing the field type in the DB. SQLite is happy to put pretty much any field type in its SQL statements. But it treats them all like memo fields.

 

TinyPortal © 2005-2018