Posts

IDisposable, or how to write bad sample code

I've started my new job and am working on some data access code to IBM's DB2. I came across the following two incongruous pages in the IBM Data Server Provider for .NET reference. First, there's the DB2Connection class. In the remarks, it specifically states: The DB2Connection object uses native resources. You should always explicitly close any open DB2Connection objects by calling Close or Dispose before the DB2Connection object goes out of scope However, on the DB2DataAdapter class reference page, they happily ignore their own advice. They also fail to mention that DB2DataAdapter is disposable and should be handled as such. Here's my recommendation for new sample code: public DataSet SelectDB2SrvRows(DataSet dataset,string connection,string query) { using (DB2Connection conn = new DB2Connection(connection)) { using (DB2DataAdapter adapter = new DB2DataAdapter()) { adapter.SelectCommand = new DB2Command(query, conn); ...

Episode 4: A new start

On February 9th, I will be starting my new position at Duke Hospital. I will be updating the software that provides the doctors a summary page view of a patient's vitals, recent lab results, and other crucial information with the option to "zoom in" on a given dataset or increase the timespace to twenty four hours, or three months, etc. This is a crucial application that helps doctors and other healthcare professionals save lives and increase quality of life for their patients. I am proud that I will be part of this team of two contractors with one mentor from the regular IT staff. At the same time, it's bittersweet leaving Microsoft in the middle of a product release cycle. There were so many more tasks to complete and improvements to make that now may be left incomplete as my team is down on pair of hands. I'm sure they'll get by, but I will miss them. Changing jobs is never easy. I hope in this blog to track my path toward a gruntled and combobulated p...