BUG: Field not set

Posts   
 
    
ChBaeumer
User
Posts: 175
Joined: 23-Oct-2003
# Posted on: 14-Sep-2005 15:00:52   

Hi,

I discovered this little oddity in version '1.0.2004.2'. I have a table in my database which references another table:

TABLE [FromAssociation]( [FromAssociationId] int NOT NULL PK, [ElementTypeId] ElementType NOT NULL, [MinAllowed] int NULL, [MaxAllowed] int NULL )

TABLE [FromAssociationNames]( [FromAssociationId] int NOT NULL PK, // Reference to table above [Locale] Locale NOT NULL PK, [IsDefault] bit NOT NULL PK, [AssociationName] String256 NULL )

In the code I do following


  FromAssociationNamesEntity _entity = new FromAssociationNamesEntity();
  _entity.FromAssociation = fromAssociationEntity;
  _entity.Locale = 9;
  _entity.IsDefault = true;
  _entity.AssociationName = "some text";

When I try to insert this entity I get an error from the database that an null value for FromAssociationId is not allowed. Due to some reason I don't unterstand the FromAssociation field of the entity is marked as Unchanged and not included in the insert statement.

If I do the following, it does work:


  FromAssociationNamesEntity _entity = new FromAssociationNamesEntity();
  _entity.FromAssociationId = -1;
  _entity.FromAssociation = fromAssociationEntity;
  _entity.Locale = 9;
  _entity.IsDefault = true;
  _entity.AssociationName = "some text";

I guess, since FromAssociationId is an integer which is initialized with 0 and I set a FromAssociation with PK = 0 that this field is never touched.

Thanx

Christoph

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 14-Sep-2005 15:42:55   

This is a bug fixed in a runtime libs build which is not available on the website yet (it's been fixed very recently). If you want I can mail you a version. If you can wait till tomorrow or so, you can download the hotfix from the website.

Frans Bouma | Lead developer LLBLGen Pro
ChBaeumer
User
Posts: 175
Joined: 23-Oct-2003
# Posted on: 14-Sep-2005 16:07:06   

Hi Otis,

thanx for your fast reply (as usual ;-)

It doesn't hurry since I use for now the workaround