Jump to content

Extrange Connection problem to Ms Access DB


Recommended Posts

Hi,im going crazy, i´ve been a week with this problem and cannot find any solution.

This script should connect to an Access DB and extract the strings with the directions of the resources to connect Network Drives.

The connection.open doesnt work

Anyone knows why?

Thank u very much

#include <WinNet.au3>
#include <AD.au3>
#include <Array.au3>
#Include <WinAPI.au3>


Dim $usuario = @UserName    
Dim $nombredbdepart = "E:\mapeando2.mdb"                                            
Dim $nombretabla = "MAPEO"          


$strQuery = "<LDAP://" & $strHostServer & "/" & $strDNSDomain & ">;(sAMAccountName=" & $usuario & ");ADsPath;subtree"
    $objRecordSet = $objConnection.Execute ($strQuery)  
    $ldap_entry = $objRecordSet.fields (0).value
    $oUsr = ObjGet($ldap_entry)  
    $usergroups = $oUsr.GetEx ("memberof")
    $count = UBound($usergroups)


Dim $query = "SELECT RECURSO FROM MAPEO WHERE DEPARTAMENTO = Informatica"

$adoCon = ObjCreate("ADODB.Connection")
    $adoCon.Open("Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & $nombredbdepart)
                    $adoRs = $adoCon.Execute($query)
                    MsgBox(0, "adoRs",$adoRs)
                    $usergroups = $oUsr.GetEx ("memberof")
                    MsgBox(0, "UserGroups",$usergroups)
            While Not $adoRs.EOF
                MsgBox(0, "MUESTRA", $adoRS)
                MsgBox(0, "Dentro de funcion hasta fin de linea",$usergroups)
                $salida = $adoRs.Fields("RECURSO").value 
                MsgBox(0, "SALIDA",$salida)
                DriveMapAdd("*",$salida)
                $len = StringLen($salida)
                MsgBox(0, "Longitud de la cadena:", $len)       
                $result = StringTrimRight($salida2, $len)
                MsgBox(0, "Cadena sin los caracteres:", $result)
                $adoRs.MoveNext
            WEnd
    $adoCon.Close

This is the error message Posted Image

And this is the database Posted Image

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...