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 = (
'CLIENT_ID=REQUIRED')
CommitAction = caRefresh
DatabaseName = 'NDSERVER'
GeneratorLinks.Strings = (
'SESSION_MGR.CLIENT_ID=SESSION_MGR_GEN')
IB_Connection = SessionConnect
KeyLinks.Strings = (
'CLIENT_ID')
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'
Origin = 'SESSION_MGR.CLIENT_ID'
ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
Required = True
end
object SessionQryCLIENT_NAME: TStringField
FieldName = 'CLIENT_NAME'
Origin = 'SESSION_MGR.CLIENT_NAME'
Size = 64
end
object SessionQryCLIENT_PWD: TStringField
FieldName = 'CLIENT_PWD'
Origin = 'SESSION_MGR.CLIENT_PWD'
Size = 64
end
object SessionQrySESSION_STATE: TIntegerField
FieldName = 'SESSION_STATE'
Origin = 'SESSION_MGR.SESSION_STATE'
end
end
*****************************************

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.


Jackie






--- In IBObjects@yahoogroups.com, 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
uniquely
> identify the record. If KeyLinksAutoDefine is true, IBO can usually
find
> 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
KeyLinks,
> 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
delete?
>
> Helen