Solved

Applications that are oblivious of the type of database (SQL or Access)

Posted on 2010-11-30
6
307 Views
Last Modified: 2012-05-10
Hello Experts,

I need to write four applications in VB.net that are totally oblivious of what database is being uised; SQL or mdb (Access). What is the best approach? Are there any classes, modules or generic functions I can use?

Before you start telling me this is a bad approach, currently these four applications are written in VBA (mde) and using Access (mdb) as a back-end. We want to port the whole thing to VB.net/Ms SQL, but for various reasons it's just not feasible to do this in one big bang. We therefore opted for porting te applications one by one to VB.net, while still using the mdb-backend. Once all applications are ported we switch to SQL and start optimizing the applications for the new databse. This way the porting can be done gradually while minimizing the impact on our customers.

Any pointers, thoughts or suggestions are greatly appreciated.

regards,
Michiel
0
Comment
Question by:altiplano
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 3

Assisted Solution

by:cnjuguna
cnjuguna earned 100 total points
ID: 34239298
I think creating apps that are not database-specific is actually a desirable quality and recommended.

Use ODBC that way as long as the datasource has the same name, the application does not have to deal with connecting specifications or anything of the sort.

*However*, note that not all SQL commands are available in different DBs. Syntax may also change for some commands depending on what DB you are using. It shouldn't be a problem with simple selects, inserts and updates especially if the DBs are Access and SQL server.
0
 
LVL 85

Assisted Solution

by:Scott McDaniel (Microsoft Access MVP - EE MVE )
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 100 total points
ID: 34239824
IMO, using unbound controls in VB.NET is the first step. Use a data layer (i.e. a set of classes/modules etc where you interact with the database), and you can then code that data layer to take advantage of the various databases in use.

Note that while Access is _mostly_ ANSI compliant, it's not quite there yet. You may have to work with some IF constructs to properly manage data in an Access databse versus other platforms. For example, Access includes a Boolean datatype, whereas SQL Server does not, so you can just pass True or False to SQL Server, and if you pass 0 and 1 to an Access Boolean field, you'll end up with munged data. Also, Access expects Date values to be wrapped in hash marks ( # ), while other platforms will choke on this. You can use the standard single quote delimiters for this, of course, so just be aware of things of this nature.
0
 
LVL 22

Assisted Solution

by:dportas
dportas earned 100 total points
ID: 34239923
One of the potential problems is that the Jet database designs simply may not be suitable for SQL Server. In the MDB world you could encounter tables with missing keys or tables that are dependent on row order or the use of other aspects of Jet that don't easily translate to the SQL / relational world. So as a first step I'd suggest a design review and make sure your current databases are in Normal Form and that the logical design makes sense for SQL Server. If they aren't then you may want to do some refactoring even before you port them over so that you can support both systems during the parallel run.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 51

Assisted Solution

by:Gustav Brock
Gustav Brock earned 100 total points
ID: 34240606
Use the DataTableAdapters of Visual Studio. Or even the Entity Framework.

These let you program in VB.NET (or C# or ..) while the underlying SQL is generated automatically behind the scene.

/gustav
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 100 total points
ID: 34243030
0
 

Author Comment

by:altiplano
ID: 34256156
So many options, so little time...
Thanks for the various answers, they were virtually all useful. Particularly some of the links CodeCruiser provided look like they give the answers I need.
regards,
Michiel
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

628 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