Powershell -- Access DB -- Windows Form App

This topic contains 1 reply, has 1 voice, and was last updated by Profile photo of 37mm 37mm 4 months, 1 week ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #39242
    Profile photo of 37mm
    37mm
    Participant

    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
    Profile photo of 37mm
    37mm
    Participant

    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()
    
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.