Recent

Author Topic: [Solved] Difference between table definition and screen  (Read 1940 times)

madref

  • Hero Member
  • *****
  • Posts: 949
  • ..... A day not Laughed is a day wasted !!
    • Nursing With Humour
[Solved] Difference between table definition and screen
« on: January 21, 2018, 11:21:05 am »
I have a table tbl_Seizoenen which is defined as
Code: SQL  [Select][+][-]
  1. CREATE TABLE "tbl_Seizoenen" (Sei_ID Word PRIMARY KEY ASC, SEI_Periode VARCHAR(9),
  2. Sei_Van Word, Sei_Tot Word, Sei_Selected BOOLEAN, Sei_KMV FLOAT, Sei_Letter CHAR)

And is filled like in attachment 1.
But when I make a form and try to fill it or change it, it is shown as in attachment 2.

How is that possible?
And can this be corrected?
« Last Edit: January 21, 2018, 06:08:03 pm by madref »
You treat a disease, you win, you lose.
You treat a person and I guarantee you, you win, no matter the outcome.

Lazarus 3.99 (rev main_3_99-649-ge13451a5ab) FPC 3.3.1 x86_64-darwin-cocoa
Mac OS X Monterey

andresayang

  • Full Member
  • ***
  • Posts: 108
Re: Difference between table definition and screen
« Reply #1 on: January 21, 2018, 12:20:11 pm »
Hi,

???

Can you post the code you are using to try to "fiil or change it" ?
Wee will have a better idea on what is going on.

Cheers
Linux, Debian 12
Lazarus: always latest release

Thaddy

  • Hero Member
  • *****
  • Posts: 14373
  • Sensorship about opinions does not belong here.
Re: Difference between table definition and screen
« Reply #2 on: January 21, 2018, 01:58:09 pm »
0.3 float can't be expressed in binary. Needs rounding. Use a currency type or a BCD or round. Some sql versions do it correctly, though
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

madref

  • Hero Member
  • *****
  • Posts: 949
  • ..... A day not Laughed is a day wasted !!
    • Nursing With Humour
Re: Difference between table definition and screen
« Reply #3 on: January 21, 2018, 04:35:01 pm »
I am using SQLite....

How to fix this problem?


@andresayang
It's a standard TDBEdit that i use. Which is connected to a DataSource
You treat a disease, you win, you lose.
You treat a person and I guarantee you, you win, no matter the outcome.

Lazarus 3.99 (rev main_3_99-649-ge13451a5ab) FPC 3.3.1 x86_64-darwin-cocoa
Mac OS X Monterey

Lutz Mändle

  • Jr. Member
  • **
  • Posts: 65
Re: Difference between table definition and screen
« Reply #4 on: January 21, 2018, 05:00:32 pm »
Set the property DisplayFormat of the TField component to '0.00'. If your dataset component is a TSQLQuery descendant do this in the AfterOpen event:

Code: Pascal  [Select][+][-]
  1. TNumericField(DataSet.FieldByName('Sei_KMV')).DisplayFormat:='0.00';
  2.  

The property DisplayFormat is only available for TNumericField descendants.

madref

  • Hero Member
  • *****
  • Posts: 949
  • ..... A day not Laughed is a day wasted !!
    • Nursing With Humour
Re: Difference between table definition and screen
« Reply #5 on: January 21, 2018, 06:07:53 pm »
Thanks....
This works.
You treat a disease, you win, you lose.
You treat a person and I guarantee you, you win, no matter the outcome.

Lazarus 3.99 (rev main_3_99-649-ge13451a5ab) FPC 3.3.1 x86_64-darwin-cocoa
Mac OS X Monterey

 

TinyPortal © 2005-2018