View Single Post
Old 11-08-2006   #1 (permalink)
Marco Shaw


 
 

Using ADO to read a text file

Trying the following PSH code:

$adOpenStatic = 3
$adLockOptimistic = 3

$objConnection = New-Object -comobject ADODB.Connection
$objRecordset = New-Object -comobject ADODB.Recordset

$objConnection.Open("Provider = Microsoft.Jet.OLEDB.4.0; Data Source =
c:\test.2; Extended Properties = text; HDR=YES; FMT=Delimited")
$objRecordset.Open("Select * from test.2",
$objConnection,$adOpenStatic,$adLockOptimistic)

$objRecordset.MoveFirst()

do {$objRecordset.Fields.Item("Name").Value; $objRecordset.MoveNext()} until
($objRecordset.EOF -eq $True)

$objRecordset.Close()
$objConnection.Close()

PSH errs out here:
PS C:\> $objConnection.Open("Provider = Microsoft.Jet.OLEDB.4.0; Data Source
= c:\test.2; Extended Properties = text; HDR=YES; FMT=Delimited")
Exception calling "Open" with "4" argument(s): "Could not find installable
ISAM."
At line:1 char:20
+ $objConnection.Open( <<<< "Provider = Microsoft.Jet.OLEDB.4.0; Data Source
= c:\test.2; Extended Properties = text; HDR=YES; FMT=Delimited")

What's an "ISAM"?



My System SpecsSystem Spec