Powershell -- Access DB -- Windows Form App

Welcome Forums General PowerShell Q&A Powershell -- Access DB -- Windows Form App

This topic contains 1 reply, has 1 voice, and was last updated by

 
Participant
2 years, 5 months ago.

  • Author
    Posts
  • #39242

    Participant
    Points: 0
    Rank: Member

    I have an application that I build that enters Names into a .mdb table ( access 97 .mdb 🙁 )
    What I want to do is as I am typing into the text box I want to populate the textbox with names that match from a different table/column. So for instance as I start typing I want all like entries to show up below the the text box and for each letter I enter the list get smaller and smaller till you can tab complete.

    This is the code to access the database via Access Database Engine 2010 in powershell. In the table the column is Truck_ID that I want to check against.

      $adOpenStatic = 3
      $adLockOptimistic = 3
    
      $objConnection = New-Object -comobject ADODB.Connection
      $objRecordset = New-Object -comobject ADODB.Recordset
    
      $objConnection.Open("Provider=Microsoft.ACE.OLEDB.12.0; Data Source = c:\Database\Gen3Data.mdb")
      $objRecordset.Open("Select * from Trucks", $objConnection,$adOpenStatic,$adLockOptimistic)
      $objRecordset.Fields.Item("Truck_ID").value
    

    Here is all the code
    http://pastebin.com/50dumDnA

  • #39247

    Participant
    Points: 0
    Rank: Member

    OK, So I assigned all the values from that column to a $truckID. Now this should be a easier way to make this a drop down box? That I can type and pick from whats available?

    $adOpenStatic = 3
    $adLockOptimistic = 3
    $objConnection = New-Object -comobject ADODB.Connection
    $objRecordset = New-Object -comobject ADODB.Recordset
    $objConnection.Open("Provider=Microsoft.ACE.OLEDB.12.0; Data Source = c:\Database\Gen3Data.mdb")
    $objRecordset.Open("Select Truck_ID from Trucks ", $objConnection,$adOpenStatic,$adLockOptimistic)
    $objRecordset.Fields.Item()
    $truckID = $objRecordset.GetRows() 
    $objRecordset.Close()
    $objConnection.Close()
    

The topic ‘Powershell -- Access DB -- Windows Form App’ is closed to new replies.