powershell add row to access mdb file

Welcome Forums General PowerShell Q&A powershell add row to access mdb file

This topic contains 3 replies, has 3 voices, and was last updated by

 
Participant
6 days ago.

  • Author
    Posts
  • #114028

    Participant
    Points: 0
    Rank: Member

    Hi all,

     

    I'm trying on my win 7 pc to make a powershell script that adds a row to a access mdb file.(office 2013 32 bit).

    But it fails every time, I have already install AccessDatabaseEngine.exe but without success, my code and the error:

    $Ado = New-Object -ComObject ADODB.Connection 
    
    $recordset = New-Object -ComObject ADODB.Recordset$Ado.Open("Provider = Microsoft.ACE.OLEDB.12.0;Data Source=d:\test.mdb");

    Maar dan krijg ik : Exception calling "Open" with "1" argument(s): "Kan de voorziening niet vinden. Mogelijk is deze niet juist geïnstalleerd."At D:\importinaccess.ps1:28 char:12+ $Ado.Open <<<< ("Provider = Microsoft.ACE.OLEDB.12.0;Data Source=d:\test.mdb")+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException   Can someone help me please? Kind regards

  • #114054

    Participant
    Points: 20
    Rank: Member

    Open() Method requires 4 inputs, please see

    https://docs.microsoft.com/en-us/sql/ado/reference/ado-api/open-method-ado-recordset?view=sql-server-2017

    You can get this via PowerShell

    $Ado = New-Object -ComObject ADODB.Connection 
    $recordset = New-Object -ComObject ADODB.Recordset
    $Ado.Open
    
    OverloadDefinitions
    -------------------
    void Open (string, string, string, int)
    

    I have never used this, hence I don't have a working example of the same.

  • #114067
    js

    Participant
    Points: 6
    Rank: Member
  • #114079

    Participant
    Points: 0
    Rank: Member

    Hi , thanks for your input.

     

    The problem was that i use an 32bit office, but powershell was 64bit.

    If i run powershell 32bit, it works 🙂

     

    thx

You must be logged in to reply to this topic.