I am developing a program to manage inventory and accounts. different clients need different databases like oracle/sqlserver/mysql etc. i want to make my solution work with all these database servers by only changing one string value .
i want to declare like :
dim mycmd as new myCommand(strServertype)
here if strServertype ="ORACLE" it should return type system.data.oracleclient.oraclecommand
here if strServertype ="MYSQL" it should return type system.data.mysqlclient.mysqlcommand
here if strServertype ="SQL" it should return type System.Data.SqlClient.SqlCommand
Also the connection and dataadaptor object also in the same way.
how can i write a function for this
2 Replies - 217 Views - Last Post: 16 March 2012 - 09:03 AM
#1
How to choose connection programatically from oracle/sqlserver/mysql
Posted 16 March 2012 - 08:46 AM
Replies To: How to choose connection programatically from oracle/sqlserver/mysql
#2
Re: How to choose connection programatically from oracle/sqlserver/mysql
Posted 16 March 2012 - 08:54 AM
It sounds like you would need to create a custom class that does this work for you. Some sort of encompassing class that takes in a database type.. a connection string.. and outputs a dataset (or how ever you have your data being consumed).
On the internals of this class you would have objects/adapters/connection objects for your various databases.. doing their thing as they normally would and when they are done they have one dataset to return.
Basically blackbox the whole thing.
On the internals of this class you would have objects/adapters/connection objects for your various databases.. doing their thing as they normally would and when they are done they have one dataset to return.
Basically blackbox the whole thing.
#3
Re: How to choose connection programatically from oracle/sqlserver/mysql
Posted 16 March 2012 - 09:03 AM
Edit: Best to use modi's idea, let's not make habit of ugly practice.
This post has been edited by trevster344: 16 March 2012 - 09:05 AM
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote







|