"Field cannot be updated" error with ADODataSet

From: Jim Albertson (jimalbertson_at_yahoo.co.uk)
Date: 06/28/04

  • Next message: Thomas Mueller: "Re: WHERE constants for DateTime"
    Date: Mon, 28 Jun 2004 13:19:42 +0430
    
    

    D7E, Access 2000 SP3

    I have a master-detail table setup; the master
    table linked to a ADODataSet has commandtype
    as table.

    For multi-user operation (maximum of 3
    users; with only one doing the updates, the
    other two doing browsing or reports), I set
    the following property values:

    CursorLocation is clUseServer, LockType is ltPessimistic,
    CommandType is cmdTableDirect

    To implement master-detail functionality,
    I had to resort to a parametrized SQL statement in
    the detail table lined to a ADODataSet, resulting
    in the following property values:

    CommandType is cmdText

    To implement master-detail functionality,
    I put this code in the OnNewRecord event of the
    detail dataset:
    ******
      fdatamod.adsDetailTable.FieldByName('FOREIGNKEY').value:=
        fdatamod.adsMasterTable.fieldbyname('PRIMARYKEY').asstring;
    ******

    The problem:
    (using DBGrid) Adding a new record seems to work just
    fine, but when I try to edit an existing record , the
    'Field cannot be updated' error dialog pops up.

    This is driving me insane, looks like no-one has faced
    this problem, or has not reported it in the newsgroups.

    Does the 7.1 or 7.1.1 Delphi update solve the problem?

    Any help appreciated.

    JA


  • Next message: Thomas Mueller: "Re: WHERE constants for DateTime"