TDBAdvGrid when empty I get exception

Hello,

when my TDBAdvGrid has no records to show it shows an empty line. If I edit this, I get an exception.

Can this be solved? Or do I need to program a work arround?

Best regards,
Lothar

Do you have more details? Do you have grid.FixedRows >= 1?
Do you put the dataset in insert state?

FixedRows = 1
Dataset is only opened.

It happens with a CheckBox in the grid ! When I click a few times on the CheckBox.
The other fields are ReadOnly.
grafik

I tested this with the ADOSelection demo where I specified a filter to make the dataset empty but I could not reproduce a problem in this demo.
What are you doing different?

I test it with ADOEditing.
as you did I added a filter to empty the DataSet.
Now the grid shows an enpty row.
If I type something in for field Brand and I go to the next field, the record will be inserted into the database.
My Database has a primary key not null, and therefore I get an exception.

So the best solution would be not to have an empty row because it is not allowed in my grid to add a row.
DBAdvGrid1.Navigation.AllowInsertRow is false

Is that possible?

Thank you,
Best regards,
Lothar

There is at this moment not a setting to hide this empty row.
If you have a not null primary key, you might a) need to change grid.EditPostMode and/or b) use BeforePost to ensure the primary key has a value

I don't want to insert a row. I just want to show the rows which are there. And if non is there, there is no need to edit fields or even insert a row.

It would be great if you could add a setting to hide this empty row.
My companions also complained.

My work arround is to set the fields to ReadOnly when the DataSet is empty.

Best regards,
Lothar

Isn't there already a setting?

If DBAdvGrid1.Navigation.AllowInsertRow := false
I don't want to insert a row and therefore I don't need an empty row for inserting.
Right?

At this moment, there is not a setting for this to show no rows. The behavior is the same in this respect as the standard VCL TDBGrid.