by Sweet at 2013-03-07 09:17:39
Hi,by DonJ at 2013-03-07 09:30:26
I tried to read a DBF file for search and replace a string by another but I don’t succeeded to read a simple database for the moment.
In the folder “D:\Scripts” I have a file named : “DETAIL_I.DBF”.
Here is my code :
$ConnString = “Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Scripts;Extended Properties=dBASE IV;”
$Conn = new-object System.Data.OleDb.OleDbConnection($connString)
$cmd = new-object System.Data.OleDb.OleDbCommand(“select * from DETAIL_I”,$Conn)
$da = new-object System.Data.OleDb.OleDbDataAdapter($cmd)
$dt = new-object System.Data.dataTable
Write-Host “Contents of the DataTable”
I have launched my powershell in 32Bits for use this provider but i have this error message :
[quote]Exception calling Â« Fill Â» with Â« 1 Â» argument (s): Â« The external table is not in the expected format. Â»
At line: 1 char: 9
+ $da.fill <<<< ($dt)
+ CategoryInfo : NotSpecified: ( , MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException[/quote]
Someone can help me ?
Thanks in advance for your help.
Sorry for my bad English …
The provider is not able to read the file. There isn’t much you can do about that.
Consider posting on StackOverflow; although you’re using PowerShell, this isn’t really something in PowerShell itself. The folks on StackOverflow are mostly developers and someone may have run into this.