Hi.
I'm using Lazarus 1.6.4 and FPC 3.0.2, combined with a Firebird database. I've added all the fields of a table and use a datadictionary. I show the data in de DBGrid and use a seperate form to manipulate the data and to insert a new record.
When inserting a new record, the DBGrid expands with a blank record. I don't like that, I wish the DBGrid to show only the valid records and a new record is not a valid record yet.
1. I've tried this with a query 'select * from dataset where number is not null'. This doesn't work.
2. I've tried this with dataset.Disablecontrols (and enablecontrols), this doesn't work either.
3. I've activated the option dgDisableInsert, that doesn't work either. The only solution I found is to use in the DBGrid a seperate view I created in the database. It works, but I keep wondering if there is an other solution possible.
Mailing lists / lazarus / 2017-06
How to avoid DBGrid showing new blank record
2 messages · 2 people ·
- Ffrans 1
- MMichael Van Canneyt 1
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
mvg
Frans van Leeuwen
M 06-51695390
---
Deze e-mail is gecontroleerd op virussen door AVG.
http://www.avg.com
frans wrote 16 lines
Hi.
I'm using Lazarus 1.6.4 and FPC 3.0.2, combined with a Firebird
database. I've added all the fields of a table and use a datadictionary.
I show the data in de DBGrid and use a seperate form to manipulate the
data and to insert a new record.
When inserting a new record, the DBGrid expands with a blank record. I
don't like that, I wish the DBGrid to show only the valid records and a
new record is not a valid record yet.
1. I've tried this with a query 'select * from dataset where number is
not null'. This doesn't work.
2. I've tried this with dataset.Disablecontrols (and enablecontrols),
this doesn't work either.
3. I've activated the option dgDisableInsert, that doesn't work either.
The only solution I found is to use in the DBGrid a seperate view I
created in the database. It works, but I keep wondering if there is an
other solution possible.
I don't think so.
The grid shows what is in the dataset. An inserted record is in the dataset. One possible way to do this is to collect all data for the new record in a not-data-aware manner, and only insert when it is complete.
Michael.
