Updating EntityCollection

Posts   
 
    
nefise
User
Posts: 22
Joined: 01-Dec-2006
# Posted on: 07-Dec-2006 15:41:10   

llblgen Pro version 2.0 , Adapters, Oracle, .NET 2005

I bind the form objects to EntityCollection Apps with CurrencyManager.

private void UpdRec3() { DataAccessAdapter adapter = new DataAccessAdapter(); adapter.StartTransaction(IsolationLevel.ReadCommitted, "Updates");

        try
        {
            this.Cursor = Cursors.WaitCursor;

            Apps.Items[cm.Position].IsDirty = true;
            Apps.Items[cm.Position].IsNew = false;

            adapter.SaveEntityCollection(Apps, true, true);
            adapter.Commit();       
        }
        catch (System.Exception ex)
        {
            adapter.Rollback();
            MessageBox.Show(ex.Message);
        }
        finally
        {
            adapter.Dispose();
            this.Cursor = Cursors.Arrow;
        }
    }

it gives no error messages and continues as there is nothing wrong but the update couldn't be done.

But also try assigning values directly to the fields of the EntityCollection as;

Apps.Items[0].Fields[0].DbValue = ""; but it gives the following debugger Error;

Property or indexer 'SD.LLBLGen.Pro.ORMSupportClasses.IEntityFieldCore.DbValue' cannot be assigned to -- it is read only.

Thanks

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 07-Dec-2006 18:11:54   

WHy do you want to set that property? DbValue is for the value READ from the database simple_smile So you never set that property. You should set CurrentValue using entity.SetNewFieldValue(index, value)

Frans Bouma | Lead developer LLBLGen Pro