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

2 thoughts on “Dlookup vs LINQ

    1. 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 )

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s