Hi
I have an Entity object generated against a table where the PK is an autonumber column in SQL Server. This means that when I create a new empty row in my C# code (by instantiating a new Entity object), this column/property is set to 0. Then when I call .Save() on the object, the Enitity property updates to whatever value it was assigned eg. 834 or whatever the next number happens to be.
I have this PK column bound to a textbox, which initially appears as 0, as it should. However, the problem is that the texbox doesn't update after the .Save() call to show the newly assigned number. My code is:
this.txtBuID.DataBindings.Add(new Binding("Text", ibBugRow, "buID"));
Where txtBuID is my textbox object, and ibBugRow.buID is the PK column.
When I .Save() a new instance of an ibBug object, the textbox remains at 0, even though I can see the buID PK column change to its new value in the debugger. I have even tried reloading the ibBug object from the DB after the save with:
UnitOfWork uow = new UnitOfWork();
uow.AddForSave(ibBugRow, true);
uow.Commit(new Transaction(IsolationLevel.ReadCommitted, "UOW"), true);
ibBugRow.Refetch();
But it makes no difference. (Note that I am using the UoW object to resolve another concurrency issue). ANyway, where am I going wrong? WHy doesn't the textbox update with the newly assigned PK value?
I am using SQL Server 2000, C#, .NET 2.0, Winforms, LLBLGenPro 2.0.0.0, SelfServicing.
Thanks heaps
Cheers
Brett