What provider / namespace?

B

Bob

I wrote an application that uses the SQLClient namespace. It only does an
insert using the SqlConnection, SQLCommand & SqlParameter objects. Will
this only work with Microsoft's SQL server? Do I need to write code fore
each server I want to support or is there a way to use one name space and
have it work with all servers?
90% will probably be using MS SQL server but what if someone wants to use
MySQL, Oracle, or an access dabase file?

Bob
 
W

W.G. Ryan MVP

You can only use SqlClient against Sql Server. You can use OleDb and Odbc
against any OleDb or ODBC Compliant database but I'd HIGHLY recommend
against doing that b/c you'll lose the performance and functionality
benefits associated with each. My suggestion would be to use a factory
pattern (if you use MSN Search on Factory Pattern ADO.NET there are many
references) for each of the providers you anticipate using. Also, there are
some new features in ADO.nET like the DBProviderFactory that can help the
''generic" approach you're looking for, I'd highly recommend Sahil Malik's
new ADO.NET book (http://shrinkster.com/8hp which is pure gold) for more
information on this.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top