Board index » delphi » Preventing ADO Insert

Preventing ADO Insert

(D5, ADO)
I have a simple app with two TDBgrids (master/detail).
Customer finds using up/dn arrows to navigate and space bar to set a boolean
field much faster than using mouse.
Problem arises when arrows down beyond last record - it automatically tries
to insert a rec (which is verboten in this app!).   I have tried

a)    ...BeforeInsert on the ADOquery but can only notify them then it
inserts anyway.
b)   ...OnEndOfRecordset on the ADOquery but ditto.

I'm wondering how I can prevent this behavior.

 

Re:Preventing ADO Insert


try calling Abort in the BeforePost event of the dataset
Quote
"Sydney Lotterby" <syd...@infosearch.com> wrote in message

news:3e706568$1@newsgroups.borland.com...
Quote
> (D5, ADO)
> I have a simple app with two TDBgrids (master/detail).
> Customer finds using up/dn arrows to navigate and space bar to set a
boolean
> field much faster than using mouse.
> Problem arises when arrows down beyond last record - it automatically
tries
> to insert a rec (which is verboten in this app!).   I have tried

> a)    ...BeforeInsert on the ADOquery but can only notify them then it
> inserts anyway.
> b)   ...OnEndOfRecordset on the ADOquery but ditto.

> I'm wondering how I can prevent this behavior.

Re:Preventing ADO Insert


Quote
>a)    ...BeforeInsert on the ADOquery but can only notify them then it
>inserts anyway.

In beforeInsert try

if dataset.Eof then
  abort;

--
Brian Bushay (TeamB)
Bbus...@NMPLS.com

Other Threads