In my opinion the best solution is to create intermediate class between the db and application (some type of data layer), which a number of methods for manage queries.
Description below base on SQLite as an analogy to SQLServer (ADO connector)
Mentioned class can by singleton, and you can call it instance wherever you want in your application - for SQLite it can looks like that:
private static SQLite instance;
public static SQLite getInstance()
{
if(instance == null)
{
instance = new SQLite();
thread = Thread.CurrentThread.ManagedThreadId;
}
return instance;
}
You can get the instance this way:
SQLite db = SQLite.getInstance();
This class can contain multiple methods for data manipulation for example:
public SQLiteCommand prepareQuery(string sql)
{
cmd = new SQLiteCommand(sql, conn);
return cmd;
}
public SQLiteDataReader executeReader()
{
return cmd.ExecuteReader();
}
public int executeInt()
{
object obj = cmd.ExecuteScalar();
return (int)obj;
}
but also transaction manage and diagnostoc methods.
So now - you can use this-like class in you application if you have other db sources or even db types, you can create next data-layer (for example for Oracle or MSSQL, MySQL ...) each of which has implements the same interface for example:
IDataBase
and now, you have some sort of facade, which you can replace as needed dynamicly.
From this time using db in application is concentrated in one place, and it is pure pleasure for programmer to use it - that's my suggestion.