ASP.NET
  Home arrow ASP.NET arrow Page 5 - Introduction to the ADO.NET Entity Framewo...
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? 
ASP.NET

Introduction to the ADO.NET Entity Framework using ASP.NET
By: Jagadish Chaterjee
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 3
    2009-04-09

    Table of Contents:
  • Introduction to the ADO.NET Entity Framework using ASP.NET
  • CRUD operations using ADO.NET Entity Framework: Screen Design
  • CRUD operations using ADO.NET Entity Framework: Source Code
  • Digging a bit more into the ADO.NET Entity Framework
  • What are Entity SQL queries?

  • 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


    Introduction to the ADO.NET Entity Framework using ASP.NET - What are Entity SQL queries?


    (Page 5 of 5 )

     

    I did not introduce Entity SQL queries (which are totally different from normal SQL) in this article. But, I will at some point in the future. For now, to put it simply, Entity SQL queries are very similar to classic SQL queries, except that these queries work on Entities designed using the Entity Model designer. 

    For now, let us see few simple Entity SQL queries. 

    To retrieve all "Emp" objects, we can write the following code:

    Dim ctxt As New NorthwindEntities

    Dim queryString As String = "SELECT VALUE Emp FROM NorthwindEntities.Emp AS Emp"

    Dim query As New ObjectQuery(Of Emp)(queryString, ctxt, MergeOption.NoTracking)

    Me.GridView1.DataSource = query

    Me.GridView1.DataBind()

    We can also add filter conditions as follows: 

    Dim ctxt As New NorthwindEntities

    Dim queryString As String = "SELECT VALUE Emp FROM NorthwindEntities.Emp AS Emp WHERE Emp.Dept.Deptno = 20"

    Dim query As New ObjectQuery(Of Emp)(queryString, ctxt, MergeOption.NoTracking)

    Me.GridView1.DataSource = query

    Me.GridView1.DataBind()

     Similarly, a particular value in an object can be retrieved using Entity SQL as follows: 

    Dim queryString As String = "SELECT Emp.Ename FROM NorthwindEntities.Emp AS Emp WHERE Emp.Empno = 1006"

    Dim query As New ObjectQuery(Of String)(queryString, ctxt, MergeOption.NoTracking)

    Me.lblMsg.Text = query.SelectValue(Of String)("it.ename").FirstOrDefault

    In my upcoming articles, we will see more and more examples of the ADO.NET Entity Framework together with other up-to-date Microsoft technologies. I hope you enjoyed the article and any suggestions, bugs, errors, enhancements etc. are highly appreciated at http://jagchat.spaces.live.com


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

       · Hai,This is my first article on dealing with ADO.NET Entity framework with...
       · Thanks man it reduced me lot of lines of code.
     

    ASP.NET ARTICLES

    - Adding Content to a Static ASP.NET Website
    - Building a Static ASP.NET Website in a Basic...
    - Develop Your First ASP.NET Website with Visu...
    - Run ASP.NET in Windows XP Home with Cassini ...
    - How to Test a Web Application
    - How to Add Code and Validation Controls to a...
    - Working in Source and Split Views to Build a...
    - How to Build a Web Form for a One-Page Web A...
    - How to Develop a One-Page Web Application
    - An ASP.NET Web Application in Action
    - Developing ASP.NET Web Applications
    - An Introduction to ASP.NET Web Programming
    - Introduction to the ADO.NET Entity Framework...
    - Completing an In-Text Advertising System und...
    - Programming an In-Text Advertising System un...





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