Click here to Skip to main content
15,887,472 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi all

I am designing an application that can select data from a database and put that data into a text file does anyone know if it is possible in c# to make some kind of user control that users can use to select the database type they are trying to connect to example orical sql, sql express , access, pervasive sql and then select the table and then select the columns and then be able to filter the data to select only the filtered data and then export that to a text file. any help would be appreciated

Thank you for your time
Posted

In order to make your application work with multiple database types, you will have to use interfaces and abstract classes throughout the code for database operations. Your code should make use of IDbConnection interface or DbConnection and similar classes rather than concrete classes.

Of course, this assumes that all the providers that you are going to use implement or extend the aforementioned interfaces and classes.

In order to keep your application "Loosely coupled", you can either write your own code to do so or use one of the existing frameworks available on the web. This[^] page shows a lot of third party readily available containers that can e used here.

Another roadblock I can see here is the query syntax. If there is drastic difference between query syntax used across the database, I would suggest have your own little query syntax implemented in code and then parse it according to the database that user selects.
 
Share this answer
 
There are some third party tools / libraries that can help you develop independent database applications.
Have a look at the Enterprise Library [^], for example.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900