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
FPC 3.2.4-rc1 available
by
Martin_fr
[
Today
at 11:56:28 am]
Convert table to JSON arr...
by
Thausand
[
Today
at 11:02:09 am]
How to port TArray.Sort?
by
Thaddy
[
Today
at 09:43:06 am]
Drawing a picture on the ...
by
paweld
[
Today
at 06:16:11 am]
application crashes on st...
by
guitarbug
[
Today
at 05:57:57 am]
Why is there no Chinese s...
by
PeterHu
[
Today
at 04:09:26 am]
Initialize list in functi...
by
PeterHu
[
Today
at 03:56:26 am]
Dynamic libraries in Linu...
by
Fred vS
[November 08, 2025, 10:28:42 pm]
What happens if you use "...
by
jamie
[November 08, 2025, 10:14:51 pm]
Unexpected lack of error ...
by
440bx
[November 08, 2025, 09:59:06 pm]
How detect a keypress in ...
by
creaothceann
[November 08, 2025, 09:37:38 pm]
FPC v3.2.2 internal error
by
440bx
[November 08, 2025, 09:15:48 pm]
Register global hotkey
by
LemonParty
[November 08, 2025, 09:05:25 pm]
Anyone interested in help...
by
Roland57
[November 08, 2025, 08:42:50 pm]
Distance of gridlines in ...
by
wp
[November 08, 2025, 08:08:14 pm]
CustomDraw package compil...
by
wp
[November 08, 2025, 06:54:28 pm]
Lazarus portable?
by
PascalDragon
[November 08, 2025, 06:29:28 pm]
[SOLVED]FPHTTPServer with...
by
m.abudrais
[November 08, 2025, 06:18:26 pm]
How to implement uKey-bas...
by
PascalDragon
[November 08, 2025, 06:15:20 pm]
Parsing command line stri...
by
LemonParty
[November 08, 2025, 01:21:47 pm]
synedit
by
scasparz
[November 08, 2025, 10:05:25 am]
Get Out of Squircle Jail ...
by
Hansaplast
[November 08, 2025, 09:36:22 am]
Paradox date filter
by
bytebites
[November 08, 2025, 08:25:44 am]
head hurting - DBGrid Wor...
by
robertom
[November 08, 2025, 01:52:08 am]
TScrollBox ScrollBy Metho...
by
andrew Bubble
[November 07, 2025, 11:54:17 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: Field of types ftString not persistent (Read 2373 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: 1601
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: 18311
Here stood a man who saw the Elbe and jumped it.
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
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.
wp
Hero Member
Posts: 13207
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: 3135
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: 6885
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