Hi again,
I wrote yesterday regarding accessing multiple databases for "syncing" and have a new, small problem with saving. When I execute the following code:
foreach (POS_WkstnEntity entityToImport in toMoveCollection)
{
POS_WkstnEntity newRemoteEntity = new POS_WkstnEntity();
for (int i = 0; i < entityToImport.Fields.Count; i++)
{
newRemoteEntity.Fields[i].CurrentValue = entityToImport.Fields[i].CurrentValue;
}
newRemoteEntity.Save();
}
(where toMoveCollection is, obviously, a llblgen collection of my POS_Wkstn table)
for some reason my newly created and populated entity will not save into the database. I've put a break on the .Save() and examined the entity object and all the fields are correctly filled in, but the record wont appear in the DB. However, if, just prior to the .Save() call I throw in a line assigning a value in the newly created entity by name (eg newRemoteEntity.WTN_Name = "WTN1") the code works fine (ie ALL of the fields are populated and everything is peachy within the DB). Since I plan to abstract this entire method to allow me to simply pass in a table name rather than rewriting the same method for EVERY table I need to do this copy for, assigning even a single field by name is not pausable.
What am I missing?