![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| Guest | 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 Specs![]() |
| | #2 (permalink) |
| Guest | Re: Using ADO to read a text file Try this: $objConnection.Open('Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\temp;Extended Properties="text;HDR=YES;FMT=Delimited"') -- Thanks, Roman |
My System Specs![]() |
| | #3 (permalink) |
| Guest | Re: Using ADO to read a text file "Roman Kuzmin" <z@z.z> wrote in message news:uJGAXE0AHHA.4992@TK2MSFTNGP03.phx.gbl... > Try this: > > $objConnection.Open('Provider=Microsoft.Jet.OLEDB.4.0;Data > Source=c:\temp;Extended Properties="text;HDR=YES;FMT=Delimited"') > > -- > Thanks, > Roman as an addition to Roman's anwer I have some more information and examples about opening and using textfiles with ADO (and also for using it with other providers like SQL Excel )on my blog : that can help you getting started with this CSV : http://mow001.blogspot.com/2006/03/w...-part-one.html http://mow001.blogspot.com/2006/03/w...-part-two.html Fixed Lenght : http://mow001.blogspot.com/2006/07/w...881469178.html Greetings /\/\o\/\/ |
My System Specs![]() |
| | #4 (permalink) |
| Guest | Re: Using ADO to read a text file "/\/\o\/\/ [MVP]" <mow001@hotmail.NoSpam> wrote in message news:%23UKSAP3AHHA.1224@TK2MSFTNGP04.phx.gbl... <...> > Fixed Lenght : Did you mean "Fixed Count"? :-) Jacques |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Read a line from a text file, without loading the entire file inmemory | PowerShell | |||
| How to read text file | VB Script | |||
| How to read and write a text file? | VB Script | |||
| Read a huge text file from bottom up | PowerShell | |||
| How do I read a text file and sort text by fixed positions? | PowerShell | |||