David:<br>   You do not mention the version of adodbapi you are using.  <br>&gt;&gt;&gt;import adodbapi<br>&gt;&gt;&gt;print adodbapi.version<br><br>2.4.2.2 is current. Some older versions have known problems with large binary fields -- which is just exactly what you are using.<br>

Please try again with a current version if you have not done that. If that does not do the trick, then there is yet another bug to chase...<br>download from <a href="http://sourceforge.net/projects/adodbapi">http://sourceforge.net/projects/adodbapi </a>or get the latest pywin32. <br>

<br>--<br>Vernon Cole<br><br><div class="gmail_quote">On Thu, May 17, 2012 at 11:01 AM, David L. Page <span dir="ltr">&lt;<a href="mailto:page3d@gmail.com" target="_blank">page3d@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<br>Hi,<br><div class="gmail_quote"><div><div><br></div><div>I have an .sdf file (SQL CE 3.5) that someone has given me. I need to extract some data from the file (and will need to extract similar data from similar files in the future). I&#39;m trying to write a python script to do it.</div>




<div><br></div><div>The DB file has a table (Profiles) with three items (DataID (int), Data (varbinary[8000], CreationDate(datetime)). I am having a problem accessing the varbinary data in Data. Here&#39;s a code snippet that works for the CreationDate.</div>




<div><br></div><div>==== Begin Code (test.py) ====</div><div><div>import adodbapi</div><div><br></div><div>file = &quot;D:\\Not_Synced\\Code\\GetProfile\\20120516_111500\\ProfileDB.1.1.sdf&quot;</div><div>
connstr = &#39;Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5; Data Source=%s;&#39; % file</div><div>conn = adodbapi.connect(connstr)</div><div>cur = conn.cursor()</div><div>sql = &quot;select CreationDate from Profiles where DataID = 2&quot;</div>




<div>cur.execute(sql)</div><div>result = cur.fetchall()</div><div>for item in result:</div><div><span style="white-space:pre-wrap">        </span>print item</div><div><span style="white-space:pre-wrap">        </span></div>
<div>cur.close()</div><div>conn.close()</div><div>==== End Code ==== </div><div><br></div><div>==== Begin Output ====</div><div><div><br></div><div>D:\Not_Synced\Code\GetProfile\20120516_111500&gt;python test.py</div>
<div>adodbapi v2.4.2.2 attempting: &quot;Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5; Data S</div><div>ource=D:\Not_Synced\Code\GetProfile\20120516_111500\ProfilesDB.1.1.sdf;&quot;</div><div>adodbapi New connection at 2C034F0</div>




<div>adodbapi New cursor at 2C03B50 on conn 2C034F0</div><div>Executing command=&quot;select CreationDate from Profiles where DataID = 2&quot;</div><div>(&#39;2012-01-18 10:54:19.843000&#39;,)</div><div>adodbapi Closed connection at 2C034F0</div>




<div><br></div></div><div>==== End Output ====</div><div><br></div><div>That code snippet accesses the date just fine.</div><div><br></div><div>However, when I try to access the Data by changing the select command:</div>




<div><br></div><div>sql = &quot;select CreationDate from Profiles where DataID = 2&quot;</div><div><br></div><div>I get the following error.</div><div><br></div><div>==== Begin Output2 ====</div>
<div><div><br></div><div>D:\Not_Synced\Code\GetProfile\20120516_111500&gt;python test2.py</div><div>adodbapi v2.4.2.2 attempting: &quot;Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5; Data S</div><div>ource=D:\Not_Synced\Code\GetProfile\20120516_111500\ProfilesDB.1.1.sdf&quot;</div>




<div>adodbapi New connection at 2C834F0</div><div>adodbapi New cursor at 2C83B50 on conn 2C834F0</div><div>Executing command=&quot;select Data from Profiles where DataID = 2&quot;</div><div>Traceback (most recent call last):</div>




<div>  File &quot;test.py&quot;, line 9, in &lt;module&gt;</div><div>    cur.execute(sql)</div><div>  File &quot;e:\Python27\lib\site-packages\adodbapi\adodbapi.py&quot;, line 1008, in execu</div><div>te</div><div>    self._execute_command()</div>




<div>  File &quot;e:\Python27\lib\site-packages\adodbapi\adodbapi.py&quot;, line 893, in _execu</div><div>te_command</div><div>    self._raiseCursorError(klass, _message)</div><div>  File &quot;e:\Python27\lib\site-packages\adodbapi\adodbapi.py&quot;, line 758, in _raise</div>




<div>CursorError</div><div>    eh(self.connection,self,errorclass,errorvalue)</div><div>  File &quot;e:\Python27\lib\site-packages\adodbapi\adodbapi.py&quot;, line 107, in standa</div><div>rdErrorHandler</div><div>    raise errorclass(errorvalue)</div>




<div>adodbapi.adodbapi.DatabaseError: <a href="tel:%28-2147352567" value="+12147352567" style="color:rgb(17,85,204)" target="_blank">(-2147352567</a>, &#39;Exception occurred.&#39;, (0, u&#39;Micr</div><div>osoft SQL Server Compact OLE DB Provider&#39;, u&#39;Multiple-step OLE DB operation gene</div>




<div>rated errors. Check each OLE DB status value, if available. No work was done.&#39;,</div><div>None, 0, -<a href="tel:2147217887" value="+12147217887" style="color:rgb(17,85,204)" target="_blank">2147217887</a>), None)</div>




<div>Command:</div><div>select Data from Profiles where DataID = 2</div><div>Parameters:</div><div>[]</div><div>adodbapi Closed connection at 2C834F0</div><div><br></div></div><div>==== End Output2 ====</div><div>
<br></div><div>Any help you could provide would be greatly appreciated. Thanks.</div><br></div></div><div>--Dave</div><div><br></div><div>PS I&#39;m using Win7 x64 with a Python 2.7 (32 bit) installation.</div><span class="HOEnZb"><font color="#888888"><span><font color="#888888">
<div><br></div><div><br></div></font></span></font></span></div><span class="HOEnZb"><font color="#888888"><br clear="all"><div><br></div>-- <br>David L. Page<div><div><a href="mailto:davidpage@ieee.org" target="_blank">davidpage@ieee.org</a></div>

</div><br>
</font></span><br>_______________________________________________<br>
python-win32 mailing list<br>
<a href="mailto:python-win32@python.org">python-win32@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/python-win32" target="_blank">http://mail.python.org/mailman/listinfo/python-win32</a><br>
<br></blockquote></div><br>