Is it possible to use either oledb command or sql command while accessing both databases. i mean to say if we use both data base we have to use different commands so is it possible to use any of these commands to access both databases.
Thanks & Regards,
Gopal Singh Shekhawat
Mirko MeierPosted Mar 4, 2009, 9:34 AM
Or do you want to use a SQLCommand for a SQLDatabase and a OleDbCommand for e.g. Access? Therefore you can use code as follows:
var settings = ConfigurationManager.ConnectionStrings[connectionKey];
var connection = DbProviderFactories.GetFactory( settings.ProviderName).CreateConnection();
connection.ConnectionString = settings.ConnectionString;
Therefore use the app.config to configure the database.