Offer to go to DataAccess2. This is a personal preference. Some may even offer your class static. It would be difficult to say that he is more perfect than another. You are on the way IDisposable, which is great.
I would be happy to read and keep both styles shown above in your question.
Consider that your DAL will be able to read the connection string from .config, and not only allow the transfer of values ββin the constructor.
public DataAccess2(string connStr)
{
this.connectionString = connStr;
}
public DataAccess2()
{
this.connectionString =
ConfigurationManager.ConnectionStrings["foo"].ConnectionString;
}
SqlCommand using.
using (var conn = new SqlConnection(connectionString))
{
using(var cmd = conn.CreateCommand())
{
}
}