Solved

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

Posted on 2010-11-30
6
300 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
6 Comments
 
LVL 3

Assisted Solution

by:cnjuguna
cnjuguna earned 100 total points
Comment Utility
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 84

Assisted Solution

by:Scott McDaniel (Microsoft Access MVP - EE MVE )
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 100 total points
Comment Utility
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
Comment Utility
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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 49

Assisted Solution

by:Gustav Brock
Gustav Brock earned 100 total points
Comment Utility
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
Comment Utility
0
 

Author Comment

by:altiplano
Comment Utility
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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

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

12 Experts available now in Live!

Get 1:1 Help Now