Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
Databases
»
Field of types ftString not persistent
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
Forum Rules
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
Very rough version of a s...
by
Hansvb
[
Today
at 12:44:31 pm]
Which Control should I us...
by
wp
[
Today
at 12:38:10 pm]
Fast Canvas Library V1.05...
by
microxa
[
Today
at 12:37:01 pm]
TCHATGPT — An Artificial ...
by
Martin_fr
[
Today
at 12:21:40 pm]
What happened to CocoaWSC...
by
paweld
[
Today
at 12:08:13 pm]
Pdf Viewer in Pascal
by
Dzandaa
[
Today
at 11:44:26 am]
[New Component] ExtTabCtr...
by
d7_2_laz
[
Today
at 11:31:30 am]
Single and Double, Conver...
by
jamie
[
Today
at 12:00:51 am]
Lazarus Bugfix Release 4....
by
Martin_fr
[June 13, 2026, 11:02:41 pm]
Error with last fixes_3.2...
by
Fred vS
[June 13, 2026, 10:49:27 pm]
Lazarus 4.8 on Sourceforg...
by
Enos68
[June 13, 2026, 08:00:47 pm]
Can /my/ AI help me with ...
by
microxa
[June 13, 2026, 06:49:37 pm]
Conscious Artificial Inte...
by
Dzandaa
[June 13, 2026, 05:59:22 pm]
If FileExists(
by
Bart
[June 13, 2026, 05:57:26 pm]
SynEdit theme
by
Martin_fr
[June 13, 2026, 05:17:43 pm]
docked IDE and form capti...
by
Paolo
[June 13, 2026, 02:53:50 pm]
New version of LazMapView...
by
wp
[June 13, 2026, 12:09:27 pm]
PadXml 1.1.0 – Portable A...
by
AlexanderT
[June 13, 2026, 10:38:42 am]
Arkanoid
by
Tomi
[June 13, 2026, 09:46:46 am]
Interesting video
by
Joanna
[June 13, 2026, 06:24:53 am]
IndySecOpenSSL is now ava...
by
TheMouseAUS
[June 13, 2026, 03:49:17 am]
Message CM_ShowingChanged...
by
LeP
[June 13, 2026, 02:13:51 am]
[SOLVED]Program experienc...
by
Cainnech
[June 13, 2026, 12:19:17 am]
TATTabs - how to stop a 3...
by
bobonwhidbey
[June 13, 2026, 12:03:15 am]
If you are looking for Wi...
by
avra
[June 12, 2026, 07:37:10 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: Field of types ftString not persistent (Read 2616 times)
matthijsj
Newbie
Posts: 3
Field of types ftString not persistent
«
on:
October 10, 2024, 09:43:37 am »
I have a form with a BufDataSet, a dbGrid and a datasource connecting them. When I try to enter data in a field of type ftString, the entered data is not persistent. The data is removed when I move to the next field. What do I do wrong?
Logged
matthijsj
Newbie
Posts: 3
Re: Field of types ftString not persistent
«
Reply #1 on:
October 16, 2024, 02:19:51 pm »
I entered the following code:
Code: Pascal
[Select]
[+]
[-]
procedure
TForm1
.
Button1Click
(
Sender
:
TObject
)
;
begin
BufDataset1
.
Insert
;
BufDataset1
.
FieldByName
(
'Number'
)
.
Value
:
=
1000
;
BufDataset1
.
FieldByName
(
'Naam'
)
.
Value
:
=
'EenWaarde'
;
BufDataset1
.
Post
;
end
;
However the field "Naam' does not save the data.
«
Last Edit: October 16, 2024, 03:22:35 pm by matthijsj
»
Logged
dseligo
Hero Member
Posts: 1686
Re: Field of types ftString not persistent
«
Reply #2 on:
October 16, 2024, 02:28:18 pm »
Post example project which shows your problem.
Also provide (
https://wiki.freepascal.org/Forum
):
- the name of your operating system
- the version of your operating system
- the version of your Free Pascal Compiler
- the version of your Lazarus IDE
Logged
Thaddy
Hero Member
Posts: 19268
Glad to be alive.
Re: Field of types ftString not persistent
«
Reply #3 on:
October 16, 2024, 02:36:48 pm »
Het naam veld moet een shortstring zijn. string[255]
The name field should be a shortstring type with a value to the maximum you expect.
Otherwise you store a pointer...
«
Last Edit: October 16, 2024, 02:38:26 pm by Thaddy
»
Logged
objects are fine constructs. You can even initialize them with constructors.
wp
Hero Member
Posts: 13572
Re: Field of types ftString not persistent
«
Reply #4 on:
October 16, 2024, 07:15:17 pm »
I don't see any problem with the code that you posted for TBufdataset. See attached sample project.
Logged
Zvoni
Hero Member
Posts: 3398
Re: Field of types ftString not persistent
«
Reply #5 on:
October 17, 2024, 08:18:40 am »
And shouldn't he use "AsInteger", "AsString" instead of "Value"?
Logged
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad
rvk
Hero Member
Posts: 7045
Re: Field of types ftString not persistent
«
Reply #6 on:
October 17, 2024, 09:34:21 am »
Quote from: Zvoni on October 17, 2024, 08:18:40 am
And shouldn't he use "AsInteger", "AsString" instead of "Value"?
Value is a variant, so it will accept a string and convert it back to the correct fieldtype.
But we haven't seen anything of the rest of the code and defined fields.
(Although pushing a string into a ftInteger field via a variant will result in an exception.)
Logged
matthijsj
Newbie
Posts: 3
Re: Field of types ftString not persistent
«
Reply #7 on:
October 19, 2024, 03:51:24 pm »
Size should be given when fieldtype is ftString.
Logged
Richard Marriott
New Member
Posts: 14
Re: Field of types ftString not persistent
«
Reply #8 on:
December 16, 2024, 07:20:11 am »
I assume you set up the table in the IDE, so go back to the field definitions property and make sure that the definition for 'Namm" contains a size parameter (as matthijsj suggests).
The other suggestions should all work. Value is a variant that contents the input to the field definition type. The only other thing I can think of is to try 'Append" rather than "Insert" in your code.
Logged
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
Databases
»
Field of types ftString not persistent
TinyPortal
© 2005-2018