Got an error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jjancy
    New Member
    • Jun 2010
    • 3

    #1

    Got an error

    hai..
    First of all thanks for your reply for my question about ODBC connectivity with MS Access. while doing that ODBC Connectivity, i got an error in the line
    adoCn00.Open "test"

    what should i do to clear this error. what is ado? and is it necessary to use ado for all Access connections?
  • vb5prgrmr
    Recognized Expert Contributor
    • Oct 2009
    • 305

    #2
    Okay, I recognize that adoCn00.Open line.... :) Did you create your odbc dsn via the odbc manager, found under control panel or admin tools depending upon OS? When you created it, did you set its path property to the database you wanted to open? Did you add a refrence to ADO?

    ADO = ActiveX Data Object(s)

    No, you could use DAO or RDO if you wanted but M$ has tried to push programmers towards ADO as it wraps both DAO and RDO so that you have a common interface.

    For that example, where you got that code from :) , I created the ODBC DSN (Open DataBase Connectivity Data Source Name) through the ODBC Data Source Administrator Dialog. How? Click on Add, select the appropriate driver you want to use and in this case for an Access 2k database I selected Microsoft Access Driver (*mdb). I gave it the name of test and then selected its path via the select button and I was done.

    Then to set a reference to ADO, I used 2.8 (maybe 2.5?), you goto project references. When the dialog appears hit the M key to make it jump down to where the m's start. Scroll down to Microsoft ActiveX Data Objects 2.8, put a check in the box and hit ok. Now you are ready to use that example code of using ADO with an ODBC DSN defined.

    However, you do not need to use an ODBC DSN as you can use a DSN Less connection string to connect via ado to any data source. For more on the different connection strings, see http://www.connectionstrings.com .



    Good Luck

    Comment

    Working...