A using block creates an object that is accessible only within the using block. As soon as the using block is closed, the object is disposed off.
Since the DataContext instance is your bridge to the LINQ to SQL functionality and the database, you need to have it in scope in order to query it.
Cheers,
Imar
|