12

Having recently installed the beta of VS 2010, I'm curious whether anybody knows how to get it to do something that was quite straightforward with VS 6. To create a simple database browser in VS 6, you could create an MFC application using a database view, connected to (for example an ODBC connection. Then, the interesting part. In a normal application, doing a -double-click on the control will bring up a dialog that lets you connect that control to a member variable of the dialog class. In a database application like this, however, it brings up a dialog that lets you connect the control to a field in the database:

DB Field selection in Add Member Variable dialog

Having done this for the fields we care about, we can build the application (note that we haven't typed in a single line of code) and we can browse data from the database:

Browsing live data

At this point, we have live data being read from (in this case) a SQL Server database, and we can browse through it, modify data, etc. The development is about like we'd used something like Access, but the output is a standalone executable.

How can I do the same (or how close to the same can I get) using Visual Studio 2008 or 2010?

1
  • Wizard support (for MFC, ATL support seems decent) in Visual Studio has gone downhill ever since VC 6. While all the classes are still there - you will need to write your own code to wire them together (for this particular instance), there is no friendly wizard to do it for you.
    – quixver
    Jun 23, 2013 at 13:51

1 Answer 1

15

The last remaining database project templates were removed in VS2008. Nobody writes code like this in C++ anymore. C# and VB.NET, their IDEs have very good dbase integration through the server explorer window. Give it a try, you'll find it easy going.

3
  • 1
    Note that you can write .NET code in C++/CLI, if you are really looking for pain. I'd also suggest C# or VB.NET for new code, however. Feb 8, 2010 at 9:55
  • C# is unfortunately not the answer to all the problems. Consider for example writing a plugin for Excel. If you go with 3.5 - what happens when there are other 3rd party controls that need 4.0 or 4.5? There is still a place for c++/MFC. Although for a recent project I've gone with straight win32 for the core and am using CEF to host HTML5 widgets for that extra whizz bang effect.
    – quixver
    Jun 23, 2013 at 13:57
  • The in-process side-by-side CLR versioning support is the answer to that. If you like writing XLLs in MFC and getting CEF built then have at it. It is however not a commonly available skill and patience anymore and you might well have trouble finding somebody to maintain your product some day. Jun 23, 2013 at 14:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.