Error comand asStateOpen using ADODB.Connection RRS feed

  • Pergunta

  • I'am make a connection with database access 2010

    In visual studio 2010, I adding reference  microsoft activex data objects 2.7 library and use ADODB

    but not  recognized the comand adStateOpen :

    Dim db as ADODB.Connection

     db = CreateObject("ADODB.Connection")
            db.Open("Provider='Microsoft.ACE.OLEDB.12.0';Data Source='C:dbAccess.accdb'")  // it's ok  , I have connection  with database

    db.state =  adStateOpen  ' is not recognized , I try to check status of connection

    ' I tried this code above

    if db.state = 1  then

    msgbox("connection  work!!!")    ' It's work when path the file ok


    msg("connection  failed")  ' It's not work path file not ok. 

    end if

    what can I do ?

    I uderstant  the ADODB is very old , but would like to learn .

    segunda-feira, 10 de setembro de 2012 05:41

Todas as Respostas

  • This error is caused due to the connection string that you are using, could give more details about this error?

    Microsoft Technology Associate (MTA)

    terça-feira, 11 de setembro de 2012 12:20