.NET
  Home arrow .NET arrow Page 2 - 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 - Creating a simple LINQ to SQL application: fetching information onto a web page


    (Page 2 of 5 )

    The following steps are continued from the previous section

    • Open "Default.aspx" on drag and drop a button and gridview controls. Modify the code to look like the following:


    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="SampleVB._Default" %>


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


    <html xmlns="http://www.w3.org/1999/xhtml" >

    <head runat="server">

    <title>Untitled Page</title>

    </head>

    <body>

    <form id="form1" runat="server">

    <div>

    <asp:Button ID="btnSelectStar" runat="server" Text="Select *" />

    <asp:GridView ID="GridView1" runat="server">

    </asp:GridView>

    </div>

    </form>

    </body>

    </html>

    • Once you have modified the above source, open the code behind "Default.aspx.vb" and copy the following code:


    Imports System.Data.Linq

    Partial Public Class _Default

    Inherits System.Web.UI.Page


    Protected Sub btnSelectStar_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnSelectStar.Click

    Dim db As New SampleDBDataContext

    Me.GridView1.DataSource = db.emps

    Me.GridView1.DataBind()

    End Sub

    End Class


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

    That's all. Once you press F5, you should see the following output (Fig 07):


    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 6 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek