[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Connection and other objects to work on SQL, Oracle and Access

Posted on 2007-09-28
6
Medium Priority
?
151 Views
Last Modified: 2013-11-26
Hi,

I have a data access layer code that is written to work on SQL Server. So I have sqlConnection, sqlCommand objetcs and so on. But now my client want it to work on SQL, Oracle and Access. So which objects should I use? I want it to be generic.

Regards,
MI
0
Comment
Question by:vj_mi
  • 4
  • 2
6 Comments
 
LVL 48

Expert Comment

by:jpaulino
ID: 19977158
I don't know any adapter that work with multiple databases but you can give the option to choose the connection that the user wants and according to that use different connection (oldbconnectiom, sqlconnection and oracleconnection)

jpaulino
0
 
LVL 48

Expert Comment

by:jpaulino
ID: 19977200
If you don't know how to connect you can look on http://www.connectionstrings.com/

jpaulino
0
 

Author Comment

by:vj_mi
ID: 19983485
Hi,

The database will depend on my client. Some client s will have SQL Server whereas some amy have Oracle or simply Ms-Access. My app is supposed to work on all these type of databases.

Regards,
MI
0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
LVL 48

Expert Comment

by:jpaulino
ID: 19983643
But that is no problem. What you have to do is to make an initial configuration selection the database type. Of course that you have to build diferent connection for different databases and alse different manage instruction(SELECT, UPDATE, DELETE, etc).

It's hard work but not to difficult.

jpaulino
0
 

Author Comment

by:vj_mi
ID: 19984004
Does this mean, if I have a method called GetEmployeeDetails(), I will have to write 3 functions - one for SQL, one for Oracle and for MS-Access since I will have to write 3 different declarations like:
Dim x as sqlConnection or Dim x as oleDBConnection and so on? In that case, my app will blow up in size since for every one function, I will have to write 3 functions and that would increase the maintenance cost of the app.

Regards,
MI
0
 
LVL 48

Accepted Solution

by:
jpaulino earned 1500 total points
ID: 19984048
Not necessarily.

You can create a module or class that manage your connection, your instruction, etc. and simplify most of the tasks. Something like this:

    Enum TypeDB
        TypeSQL
        TypeAccess
        TypeOracle
    End Enum

    Public Function ExecuteCommand(ByVal query As String, ByVal ConnectionType As TypeDB) As Boolean
        Select Case ConnectionType
            Case TypeDB.TypeSQL
                Dim conn As SqlConnection
                Dim cmd As SqlCommand = New SqlCommand(query, conn)
                ExecuteCommand = cmd.ExecuteNonQuery()
                ' ...
            Case TypeDB.TypeOracle
                ' ...
            Case TypeDB.TypeAccess
                ' ...
        End Select
    End Function

I never sow another way & perhaps exists but not that I know

jpaulino
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

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

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

873 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