Alec Tang

Professional Web Developer/ Web Designer

I build websites based on the latest web standards providing the best possible solution to your company

  • Home
  • About
  • Portfolio
  • Contact
  • Blog
Subscribe Feed

Some basic LinQ to SQL syntax

Posted by Alec on Wed, 04 Mar 2009, in LINQ   SQL   

Have been trying to use Telerik Open Access ORM for the core framework. Finally have the basic structure setup. With having business objects layer, persistant classes and data access layer seperated, the web app itself could just communicate with the business objects, which then calls to persistant classes and data access layer.

Using business object layers could greatly minimise the pain when updating and retrieving data in the database. Dealing with objects is just great and saves a lot of time. Telerik ORM allows many different database technologies to be used and the one I am using is LinQ to SQL. Here's some basic ones to remember:

To Retrieve an object with id:

var result = from c in scope.Extent() where c.CompanyID == id select c;

To Retrieve a set of result with a limit:

var result = (from c in scope.Extent() select c).Skip(0).Take(intLimit); return result.ToList();

To update an object:

you must first retrieve the object out and then update it before committing it.

Comments Be the first to write a comment. Comment gets approved before publishing.

Post Your Comment

 
 
   

Search

 

Latest Posts

  • List Attachments Open as Read Only
  • Website finally back up from Google's block
  • Sys.WebForms.PageRequestManagerParserErrorException
  • How Google treats Content Duplication
  • How to create HTML column in Sharepoint List View
  • How Sharepoint stores User Data
  • How to send email via Sharepoint
  • Malaysia Airlines launched iPhone Application: MHMobile
  • Intranet, the next big market
  • How to retrieve and update from a multi choice Checkboxlist ...

Categories

  • Browsers (1)
  • Projects (1)
  • Web Design (7)
  • Sharepoint (21)
  • Telerik (5)
  • Wordpress (1)
  • Internet (2)
  • SQL (5)
  • LINQ (3)
  • ASP.NET C# (34)
  • JavaScripts (3)
  • IIS (0)
  • Industry (1)
  • Tools (8)
  • SEO (5)

Archives

  • September 2010 (1)
  • August 2010 (1)
  • May 2010 (1)
  • April 2010 (3)
  • March 2010 (5)
  • February 2010 (4)
  • January 2010 (11)
  • November 2009 (3)
  • October 2009 (1)
  • September 2009 (9)
  • August 2009 (3)
  • July 2009 (4)
  • June 2009 (1)
  • May 2009 (2)
  • April 2009 (8)
  • March 2009 (6)
  • February 2009 (2)
© Copyright 2009 Alec Tang. All Rights Reserved.
This site is conform to W3C Standard XHTML & CSS