Hi, I have been banging my head on this issue for a bit of time now.
I have a vb.net windows form application and I'm attempting my first discovery of linq to sql. Using sql server 2005.
To simplify I have a main form with fields. Address1 address2 etc
I have a class names clsCompany with has the logic to run a query and retrieve records via linqtosql. I then pass the table back to the main form via a property and then bind it to a bindingsource. No great shakes yet.
I then update some fields and want to run db.submitchanges.
Now the datacontext cannot be set as global as the data will go stale.
So the question I really need answering.
What is the recommended way for me to set this model up.
Draw the data via the first datacontext. Let it go out of scope and then on update create a new one and pass the fields independently?
Actually keep the datacontext global/live?
The first issue obviously losses the change tracking ability etc
Thanks in advanced Scott
Also refer to