.NET
  Home arrow .NET arrow Introducing LINQ to SQL Designer using Vis...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
.NET

Introducing LINQ to SQL Designer using Visual Studio 2008
By: Jagadish Chaterjee
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 19
    2008-04-07

    Table of Contents:
  • Introducing LINQ to SQL Designer using Visual Studio 2008
  • Creating a simple LINQ to SQL application: fetching information onto a web page
  • Creating a simple LINQ to SQL application: updating information to the database
  • Creating a simple LINQ to SQL application: handling transactions using LINQ
  • Explanation of handling transactions in LINQ to SQL

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Introducing LINQ to SQL Designer using Visual Studio 2008


    (Page 1 of 5 )

    This is an introductory article that focuses on designing LINQ to SQL objects using the LINQ to SQL Designer in Visual Studio 2008. Apart from designing, we will concentrate on fetching and updating databases using the model created with Designer.

    If you are a bit new to programming LINQ, please consider reading my previous article titled "Beginning 'LINQ to SQL' using Visual Studio 2008."

    The entire source code for this article is available in the form of a free downloadable zip file. The solution was developed using Microsoft Visual Studio 2008 Team Edition on Microsoft Windows Server 2003 Standard Edition with Microsoft SQL Server 2005 Developer Edition. I didn't really test it in any other environment. I request that you post in the discussion area, if you have any problems in execution.

    Creating a simple "LINQ to SQL" application: creating the project

    In my previous article, we focused on "LINQ to SQL" development without working with a designer. "LINQ to SQL" designer is a great choice and has lots of features that we can take advantage of. We can take full advantage of it, if we know what it is doing internally.

    Before going into complete internal details, let us start by creating a 'LINQ to SQL' application using a designer.

    To make this article simple, I created two tables, "emp" and "dept," as follows:


    The following are the steps used to create an ASP.NET 3.5 application with a "LINQ to SQL" designer:

    • Open Visual Studio 2008

    • Go to File || New || Project

    • In the "New Project" dialog, make sure ".NET Framework 3.5" is selected. In the "Project Type," select either "Visual Basic || Web" or "Visual C# || Web".

    • Select "ASP.NET Web Application" in the templates, provide the name of the application (Fig 3), and finally hit OK.


    Creating a simple "LINQ to SQL" application: using "LINQ to SQL Designer"

    The following steps are continued from previous section.

    • Right click on solution and go to Add || New Item (Fig 03)

    • Select "LINQ to SQL Classes" from the templates, provide the DataContext name and hit "Add". It is always recommended to provide a database name (unless you are working with multiple databases). The following is the screenshot (Fig 04):

    • If not already open, open "Server Explorer" (go to View || Server Explorer) and connect to your database. Make sure that you have both tables (along with their relationship) as mentioned in the previous section. The following gives you a better idea (Fig 05):

    • Drag and drop "dept" and "emp" from "Server Explorer" on to the designer (Fig 06).

    • Make sure "Web.Config" is modified with the connection string (should be automatic).

    More .NET Articles
    More By Jagadish Chaterjee


       · Hello guys, This is my second article in the series and is an introductory...
     

    .NET ARTICLES

    - Building Applications with Windows Workflow ...
    - Building the Data and Business Layers Using ...
    - The Transformed XML Explorer in MFC
    - List Control and Property Grid with the MFC ...
    - Font, Shell and Masked Edit Controls for MFC
    - Color, Link and Image Editor Controls for M...
    - New Controls for MFC
    - The Windows Ribbon Framework
    - Markup Language for the Ribbon Framework
    - Visually Upgrade Your MFC Project
    - New Features for the Statusbar in MFC
    - Working with the Statusbar in MFC
    - Iron Speed Design v60 Review
    - Binary and XML Serialization
    - Using CrystalReportViewer to Display Crystal...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek