Wrox Programmer Forums
|
ASP.NET 3.5 Basics If you are new to ASP or ASP.NET programming with version 3.5, this is the forum to begin asking questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 9th, 2009, 02:22 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Date retrieval Neal Excel VBA 1 February 1st, 2007 06:43 AM
For XML data retrieval fancorning4 SQL Server 2000 2 May 18th, 2006 10:33 AM
XML Retrieval Help t3projects BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0 0 October 11th, 2005 03:24 PM
Need help with JSP data retrieval crashpoint Java Databases 1 August 3rd, 2005 01:00 AM
Data retrieval using MySQL rajanikrishna Beginning PHP 2 November 12th, 2003 11:38 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.