I have used SqlConnection to connection to Sql database. There are some friends, they always use IDbConnection. He also suggest me use IDbConnection. I also see some of project here using IDbConnection: AccountPlus[^]
_ What's the difference bettwen SqlConnection and IDbConnection.
_ Using IDbConnection is better?
SqlConnection implements IDbConnection and therefore IS_A IDbConnection.
In my opinion, one should code to the interfaces; that's what I do, and I'm not the only one. It may not matter now, but if you ever have to provide support for another database, you'll be glad you did.
I regularly work with SQL Server, MySQL, Oracle, Access, and Excel. In the past I've also had to work with Cache, Ingres, and maybe some others I've forgotten. As long as there's an ADO.net connector, my code can work with it.
To add to PIEBALDconsult's answer IDbConnection is not used in LINQ to SQL DataContext or Entity Framework.
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
Last Visit: 31-Dec-99 18:00 Last Update: 17-Sep-14 4:09