Dlookup vs LINQ

If you are a Microsoft Access developer you will surely use the DLookup function.  Dlookup is a function that queries a data whether it is single, computed or aggregate from a table with a given criteria.

Dim sellingPrice as double
sellingPrice = DLookup("sellingPrice","mstItem","itemId=123")
Messagebox sellingPrice

The above example code queries the selling price in the mstItem table where itemId is 123.  However essential is the DLookup function in Microsoft Access development it is not available in Microsoft Lightswitch, instead the latter provided us with a more powerful tool, LINQ.  The LINQ equivalent of the DLookup code above is as follows:

Dim item = (From i In Me.DataWorkspace.mstItem Where i.itemId = 123 Select i).First
Me.ShowMessageBox(item.sellingPrice.toString())
Advertisements
About

Software developer living in the Philippines.

Posted in Lightswitch
2 comments on “Dlookup vs LINQ
  1. Jerico Canete says:

    nice…mao ba chief? hehehe…dili ko kama ani

    • hgminerva says:

      English please….hehehehe….yes…we have to adapt to new technology that uses thin pipeline to access to relational databases so that we can deploy cloud computing applications. LINQ uses entity framework to manipulate databases.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Author

Harold Glenn P. Minerva
Software Developer / Tech Enthusiast
Living in the Philippines

View Harold Glenn Minerva's profile on LinkedIn

Instagram

Software Engineer - Seasonal and Range Trading Software. Magenta Trader is a powerful stock market visualization software that increases your probability of trading success.

Software Architect and Founder - Easyfis.com is a multi-tenant cloud-based Software-as-a-Service (SaaS) business app that caters to micro, small and medium trading businesses.

CTO and Co-Founder - We give your company the leverage by providing innovative software solutions products such as Point-of-Sales (POS), Financial Information System (FMIS), Payroll and DTR (HRIS), and many more.

%d bloggers like this: