![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #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 | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Howto: Add lines of text from a specific point in a text file.. | Daz | VB Script | 13 | 06-24-2008 10:55 AM |
| How to read and write a text file? | Jirong Hu | VB Script | 1 | 06-14-2008 03:31 PM |
| Read a huge text file from bottom up | Hayato Iriumi | PowerShell | 4 | 04-25-2008 02:44 PM |
| How do I read a text file and sort text by fixed positions? | Cornelius | PowerShell | 5 | 07-20-2007 06:34 PM |
| Read mails in plain text | Simon | Vista mail | 3 | 07-03-2006 01:06 PM |