Board index » delphi » Locate returns true but does not move my record cursor

Locate returns true but does not move my record cursor

I have a TADOTable connected to a TADOConnection.  The TADOconnection
cursorlocation has been set is set to clUseClient.  The TADOTable cursor
Type is ctStatic.  The lock type is ltBatchOptimistic.  I have a
TCombobox with a drop down list of primary keys for record numbers.
When I run this code:

===========================================================================
if
tblShip.Locate('ShippingID',cboShipRec.Items[cboShipRec.ItemIndex],[])
then ShowMessage('Found ' + cboShipRec.Items[cboShipRec.ItemIndex]);
===========================================================================

The result is true but my bound form does not reflect the cursor
position (based on the locate method returning true).

Why does the locate method return true but my form does not reflect the
new cursor position?

Thanks,
Bill N
www.2rs.ca

 

Re:Locate returns true but does not move my record cursor


There's good reason why locate will return true and my form does reflect
the cursor position.  The reason is because I was suffering from brain
drain and hooked up the wrong TDataSource to my DBControls.

It is amazing how a couple of clicks in the object inspector can fix things.

Thanks,
Bill N
www.2rs.ca

Quote
Bill N wrote:
> I have a TADOTable connected to a TADOConnection.  The TADOconnection
> cursorlocation has been set is set to clUseClient.  The TADOTable cursor
> Type is ctStatic.  The lock type is ltBatchOptimistic.  I have a
> TCombobox with a drop down list of primary keys for record numbers. When
> I run this code:

> ===========================================================================
> if
> tblShip.Locate('ShippingID',cboShipRec.Items[cboShipRec.ItemIndex],[])
> then ShowMessage('Found ' + cboShipRec.Items[cboShipRec.ItemIndex]);
> ===========================================================================

> The result is true but my bound form does not reflect the cursor
> position (based on the locate method returning true).

> Why does the locate method return true but my form does not reflect the
> new cursor position?

> Thanks,
> Bill N
> www.2rs.ca

Other Threads