Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I DID IT!!!!</p> <p>There where several problems with what I was doing so, here I come with what I did to solve it (after implementing it the first time with Ethan Furman's solution)</p> <p>The first thing was a driver problem, it turns out that the Windows' DBF drivers are 32 bits programs and runs on a 64 bits operating system, so, I had installed Python-amd64 and that was the first problem, so I installed a 32bit Python.</p> <p>The second issue was a library/file issue, according to <a href="https://stackoverflow.com/questions/754436/odbc-dbf-files-in-c-sharp">this</a>, dbf files in VFP > 7 are diferent, so my pyodbc library won't read them correctly, so I tried some OLE-DB libraries with no success and I decided to to it from scratch.</p> <p>Googling for a while took me to <a href="http://mail.python.org/pipermail/python-win32/2006-March/004420.html" rel="nofollow noreferrer">this</a> post which finally gave me a light on this </p> <p>Basically, what I did was the following:</p> <pre><code>import win32com.client conn = win32com.client.Dispatch('ADODB.Connection') db = 'C:\\Profit\\profit_a\\ARMM' dsn = 'Provider=VFPOLEDB.1;Data Source=%s' % db conn.Open(dsn) cmd = win32com.client.Dispatch('ADODB.Command') cmd.ActiveConnection = conn cmd.CommandText = "Select * from factura, reng_fac where factura.fact_num = reng_fac.fact_num AND factura.fact_num = 6099;" rs, total = cmd.Execute() # This returns a tuple: (&lt;RecordSet&gt;, number_of_records) while total: for x in xrange(rs.Fields.Count): print '%s --&gt; %s' % (rs.Fields.item(x).Name, rs.Fields.item(x).Value) rs.MoveNext() #&lt;- Extra indent total = total - 1 </code></pre> <p>And it gave me 20 records which I checked with DBFCommander and were OK</p> <p>First, you need to install <a href="http://sourceforge.net/projects/pywin32/files/pywin32/" rel="nofollow noreferrer">pywin32 extensions</a> (32bits) and the <a href="http://www.microsoft.com/en-us/download/details.aspx?id=14839" rel="nofollow noreferrer">Visual FoxPro OLE-DB Provider</a> (only available for 32bits), in my case for VFP 9.0</p> <p>Also, it's good to read de <a href="http://www.w3schools.com/ado/default.asp" rel="nofollow noreferrer">ADO Documentation</a> at the w3c website</p> <p>This worked for me. Thank you very much to those who replied </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload