SqlDataAdapter.Fill() does not require SqlConnection Open() and Close()

I have read too many articles showing the connection being opened and closed around a DataAdapter Fill() as in the code below. It does no harm, but it not necessary. Don’t do this… SqlCommand command = new SqlCommand(“usp_MyQuery_Select”, this._con);SqlDataAdapter adapter = new SqlDataAdapter(command);DataSet ds = new DataSet();try{   this._con.Open(); //unnecessary   adapter.Fill(ds);}finally{   …

VSDN Tips & Tricks .NET Coding Standards

Most developers cringe when they hear the words “Coding Standards.” A developers coding style defines them. Their style has been molded over the years into what it is today. Telling a developer that their way is not the “right way” is difficult and sometimes taken personally. Coding standards are, however, …