Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How Do I connect to different databases seamlessly using ADO .NET

Status
Not open for further replies.

mvanrijn

Programmer
Jun 23, 2002
19
GB
Hi,

I'm writing an application which reads a file, and inserts records into either a SQL server database or a MySQL database. The table structures are the same in each database.

My first thought was to use ODBC to connect to the different databases. But one further reading it looks like these are being discontinued.

So then I started to look at ADO .NET

I have found the System.Data.SqlClient to connect to the SQL server database

and I have found a MySql.Data.MySqlClient to connect to the MySQL database.

To insert the rows from my file do I have to write seperate code for each ADO .NET driver? Or am I just missing something here? Just a little confused.

Thanks
MJ
 
If your code will not going to use any T-SQL specific extensions, you can use the code as is to update the two table in the two different databases. All you need to do is to have two different connections and to make sure that you use the right connection before submitting your commands.



Walid Magd (MCP)

The primary challenge of every software development team is to engineer the illusion of simplicity in the face of essential complexity.
-Grady Booch
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top