.NET Framework - Extract data from dBase DB

Asked By Tobias Nissen on 24-Jun-11 08:33 AM
Hi,

I have the following script which works fine on Windows 7 but quits
with an error message on Windows XP:

$ConnString = "Provider= Microsoft.ACE.OLEDB.12.0 ; Data Source=d:\temp ; Extended Properties= dBASE IV "
$conn = new-object System.Data.OleDb.OleDbConnection($ConnString)

$conn.open()

$cmd = new-object System.Data.OleDb.OleDbCommand("select foo from bar",$Conn)
$da  = new-object System.Data.OleDb.OleDbDataAdapter($cmd)
$dt  = new-object System.Data.DataTable

$da.fill($dt)
$date = (get-date).ToString('yyyyMMdd')
$file = New-Item -type file "d:\temp\foo-$date.txt"
$dt > $file

$conn.close()

This is the error message I get on Windows XP:

Exception calling "Fill" with "1" argument(s): "Index not found."
At D:\temp\test.ps1:10 char:9
+ $da.fill <<<< ($dt)
+ CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException

Can you see what is wrong? Is it the connection string?

What would I have to change to access a Firebird DB? Could you point
me to some documentation that helps me understand the differences
between ACE, OLE, Jet, ODBC, and so on?

TIA,
Tobias




CWhite replied to Tobias Nissen on 07-Jul-11 02:02 PM
MethodInvocationException

Sounds like this might be related to this knowledgebase entry, since I
notice you are using the Access Dateabase Engine provider:

http://support.microsoft.com/kb/287428

Best Regards,
Chris White