You may want to look at some existent ODBC wrapper classes like http://www.naughter.com/odbcwrappers.html