ADO Late binding note – avoid missing reference & compatibility issues.

If you have been developing for large organisations then this will be familiar “It doesn’t work on my machine but rest of my team is fine”.You then investigate and find a  missing reference due to missing/different versions of a dll. To get around this you can choose not to select a library during development but instead declare generic objects and later specify them as ADODB, thus allowing the machine to select whichever version the user happens to have.

The obvious pitfall here is that their version of the dll may not contain a method which came later so try to use the earliest version possible to test with.

So to recap, instead of :
Dim cn As New ADODB.Connection, rs As New ADODB.RecordsetUse:
Dim cn as object, rs as object
Set cn = CreateObject(”ADODB.Connection”)
Set rs.= CreateObject(”ADODB.Recordset”)

Share and Enjoy:
  • email
  • Print
  • Digg
  • Facebook
  • Twitter
  • del.icio.us
  • Sphinn
  • Google Bookmarks
  • Blogplay
  • Add to favorites
  • Diggita
  • LinkedIn
  • Live
  • MySpace
  • Reddit
  • RSS
  • StumbleUpon
  • Technorati
  • Slashdot

Leave a Reply