Board index » delphi » Post error on second access of record

Post error on second access of record

I have an application that works well.  In the BeforePost routine the app
checks for several things and posts if all is well.

The problem comes in if a user discovers he/she mistyped some information
and wants to correct it.  They use the Navigator to update the record, make
the change and receive an error saying the rowset can't be found for
updating.  Has anyone come accross this?

Ted

 

Re:Post error on second access of record


Ah - Sql-Server no doubt. You must have a unique index on a Sql-Server
table, otherwise it can not be updated. If the table design doesn't require
it add an identity and use that as the primary instead.

--
Adroit Software Ltd
------------------------------
Remove the nospam. to mail me direct

Quote
"Ted Hale" <t...@srs-inc.net> wrote in message news:3b82509a$1_2@dnews...
> I have an application that works well.  In the BeforePost routine the app
> checks for several things and posts if all is well.

> The problem comes in if a user discovers he/she mistyped some information
> and wants to correct it.  They use the Navigator to update the record,
make
> the change and receive an error saying the rowset can't be found for
> updating.  Has anyone come accross this?

> Ted

Re:Post error on second access of record


Quote
>The problem comes in if a user discovers he/she mistyped some information
>and wants to correct it.  They use the Navigator to update the record, make
>the change and receive an error saying the rowset can't be found for
>updating.  Has anyone come accross this?

The default behavior for ADOExpress is to locate the record to update on all the
field values.  If you have default values set in the database or fields that get
updated as a result of a trigger the record will not be found on subsequent
access  and you will get this error until your requery the data.

You can change this to use only the key fields
 set the 'Update Criteria' dynamic property:-

ADODataSet1.Properties['Update Criteria'].value :=adCriteriaKey;
put this code in the BeforeUpdate method.
--
Brian Bushay (TeamB)
Bbus...@NMPLS.com

Re:Post error on second access of record


Thanks I'll try that.  My current workaround was to refresh the dataset.
Limited # of records made it fast enough though there had another way...

Thanks again

Ted

"Brian Bushay TeamB" <BBus...@Nmpls.com> wrote in message
news:p976otslbaqh30c50k2iage968h711i1n9@4ax.com...

Quote

> >The problem comes in if a user discovers he/she mistyped some information
> >and wants to correct it.  They use the Navigator to update the record,
make
> >the change and receive an error saying the rowset can't be found for
> >updating.  Has anyone come accross this?

> The default behavior for ADOExpress is to locate the record to update on
all the
> field values.  If you have default values set in the database or fields
that get
> updated as a result of a trigger the record will not be found on
subsequent
> access  and you will get this error until your requery the data.

> You can change this to use only the key fields
>  set the 'Update Criteria' dynamic property:-

> ADODataSet1.Properties['Update Criteria'].value :=adCriteriaKey;
> put this code in the BeforeUpdate method.
> --
> Brian Bushay (TeamB)
> Bbus...@NMPLS.com

Re:Post error on second access of record


The standard ADO solution to this problem is Update Resync, but
refreshing the dataset manually works are well (as you found out). If
refreshing is already working for you, then that's the solution.

--

My reply-to address is purposely mangled to thwart auto-reply bots.
Please remove the two leading underscores if you wish to reply via
e-mail.

Other Threads