Subject Re: [IBO] Record was not located to delete
Author jliu1530
Thanks, Helen. I am attaching my query below,

object SessionQry: TIBOQuery
Params = <>
AutoCalcFields = False
AutoFetchAll = True
ColumnAttributes.Strings = (
CommitAction = caRefresh
DatabaseName = 'NDSERVER'
GeneratorLinks.Strings = (
IB_Connection = SessionConnect
KeyLinks.Strings = (
RecordCountAccurate = True
AfterInsert = SessionQryAfterInsert
AfterPost = SessionQryAfterPost
RequestLive = True
SQL.Strings = (
'select * from SESSION_MGR')
FieldOptions = []
Left = 112
Top = 304
object SessionQryCLIENT_ID: TIntegerField
FieldName = 'CLIENT_ID'
ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
Required = True
object SessionQryCLIENT_NAME: TStringField
FieldName = 'CLIENT_NAME'
Size = 64
object SessionQryCLIENT_PWD: TStringField
FieldName = 'CLIENT_PWD'
Size = 64
object SessionQrySESSION_STATE: TIntegerField

So my DB aware grid is using the SessionQry to show data in the table
SESSION_MGR that has field CLIENT_ID as the PK.

The KeyLinks of the SessionQry is set to CLIENT_ID and
KeyLinksAutoDefine is set to true.

When user is editing in the grid, it is possible that they are editing
one record and then realize they don't want this record at all, so
they click the delete button to delete it.


--- In, Helen Borrie <helebor@t...> wrote:
> At 10:19 PM 19/10/2004 +0000, Jackie wrote:
> > I have a DB aware grid showing
> >a bunch of records. When I change some fields of a record in the grid
> >and click my delete button, I do the following,
> >
> >HolDBView->DataController->DataSource->DataSet->Delete();
> >
> >I get an exception that says "Record was not located to delete.". It
> >seems to me the delete requires all fields match.
> Delete requires only to be able to find the KeyLinks fields that
> identify the record. If KeyLinksAutoDefine is true, IBO can usually
> the keylinks itself, provided the primary key is in the dataset and the
> query involves only one table.
> If the Keylinks are wrong, it can then only seek the record by using
all of
> the fields.
> >Shouldn't IBO just use the PK to locate a record and delete it? What I
> >need to do for this problem?
> Send the SQL for the query, the columns that you have assigned as
> and also tell us what is the purpose of this:
> "When I change some fields of a record...."
> What is the purpose of changing fields in a record you are about to
> Helen