Solved

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

Posted on 2010-11-30
6
303 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
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 84

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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 49

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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

789 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