Solved

Using the equivalent of Dlookupand Dmax functions from MS Access in Visual Studio 2008

Posted on 2009-04-15
4
208 Views
Last Modified: 2013-11-26
Hi there
I am new to Visual studio (using the VB mosule) and am battling a bit with returning values from and writing values to an MS Access table.
I need to do a Dlookup and a DMax on the ControlNo field in a table called tblControlNo in an MS Access DB.
Is there a functions list that I can look these up for myself or do I need to go the slog of asking questions of you bgurus every time I need to do some command in VB
0
Comment
Question by:caandal
  • 3
4 Comments
 
LVL 53

Accepted Solution

by:
Dhaest earned 500 total points
Comment Utility
DLookup is specific to Microsoft Access and VBA and there currently is no language-integrated query functionality equivalent in .NET. You would need to use the OLEDB namespace library and ADO.NET data objects to query the database.

The next version of Visual Studio (ORCAS) will have something similar to this feature called Linq and DLinq. There is a CTP available if you're interested:

http://msdn2.microsoft.com/en-us/netframework/aa904594.aspx

0
 
LVL 53

Expert Comment

by:Dhaest
Comment Utility
.NET has several ways to achieve what you want depending on how you're storing your data.

1. LINQ
2. ADO.NET database query (SELECT MyColumn FROM MyTable WHERE MyColumn = SOMEVALUE )
3. .Find Delegate (supported on some collections)
4. Dataset/DataView filters
0
 
LVL 53

Expert Comment

by:Dhaest
Comment Utility
0
 

Author Closing Comment

by:caandal
Comment Utility
Hi Dhaest.  You have pointed me in the right direction
tx
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now