My initial guess would be that you want your string literal to be a raw string 
literal.  That is it should have the r prefix such as r"data source=...".  I'm 
guessing the C# code might have been doing @"data source=..." because of the 
"\n" in the connection string.

From: users-boun...@lists.ironpython.com 
[mailto:users-boun...@lists.ironpython.com] On Behalf Of Hank Fay
Sent: Tuesday, April 27, 2010 8:09 PM
To: users@lists.ironpython.com
Subject: [IronPython] Advantage Database ado.net provider difficulties

I'm trying to use the Advantage Database ado.net<http://ado.net> provider 
(9.0.2.7) working in IronPython (2.6.1003.1).  OS is Win7 x64; IDE is #develop 
4.0.0.5720.  I'm getting an error that isn't telling me much.  This is based on 
a C# example I have running on the same machine, in VS2010 RTM.

Here's the code (Advantage.Data.Provider.dll is referenced in the project).  It 
blows up on the last line, with the error noted below the code.  My hope is 
that the error will mean more to those with more experience than I and point me 
in a useful direction.  FYI: the code references a directory as a database, and 
the CommandText selects a field from a DBF that is a free table, that is, not 
part of a VFP database container (if you were to get the idea that I'm 
retreading in IP after 24 years developing in xBase languages, you would hit 
the mark <s>).

import Advantage.Data.Provider
from Advantage.Data.Provider import *

_conn = Advantage.Data.Provider.AdsConnection("data 
source=c:\\vpme9apps\next\scaledsardine\versionb\xcase;\
ServerType=local; TableType=CDX")
_conn.Open()
_cmd = _conn.CreateCommand()
_cmd.CommandText = "select name from ddent"
_reader = _cmd.ExecuteReader()

And the error:

Advantage.Data.Provider.AdsException: System error.
   at Microsoft.Scripting.Actions.Calls.MethodCandidate+Caller.Call(Object[] 
args, Boolean shouldOptimize)
   at 
IronPython.Runtime.Types.BuiltinFunction+BuiltinFunctionCaller`6[System.Object,System.String,IronPython.Runtime.PythonDictionary,IronPython.Runtime.PythonDictionary,IronPython.Runtime.PythonTuple,System.Int32].Call5(CallSite
 site, CodeContext context, Object func, String arg0, PythonDictionary arg1, 
PythonDictionary arg2, PythonTuple arg3, Int32 arg4)
   at System.Dynamic.UpdateDelegates.UpdateAndExecute7(CallSite site, Object 
arg0, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object 
arg6)
   at IronPython.Runtime.Importer.Import(CodeContext context, String fullName, 
PythonTuple from, Int32 level)
   at IronPython.Runtime.Operations.PythonOps.InitializeModule(Assembly 
precompiled, String main, String[] references)
   at PythonMain.Main()

tia,

Hank Fay
_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to