The issue is not with the python code itself but rather something in the qgis code for the ogr provider.  I know there is a bug there I'm just having trouble tracking down what it is.<br><br><div class="gmail_quote">On Wed, Apr 13, 2011 at 6:07 PM, Yves Jacolin <span dir="ltr"><<a href="mailto:yjacolin@free.fr">yjacolin@free.fr</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Christophe,<br>
<br>
Why do you say the issue come from the python code? Your example shows nothing<br>
;)<br>
<br>
What is the result of your last command?<br>
<br>
Y.<br>
Le mercredi 13 avril 2011 09:49:04, Christophe B a écrit :<br>
<div><div></div><div class="h5">> Hello Yves,<br>
><br>
> I tried to convert my table to a shapfile with ogr2ogr (GDAL 1.8.0,<br>
> released 2011/01/02) and it works : my shapfile has geometry and attribute<br>
> data. It is therefore a problem whis python code !<br>
><br>
> >>> conn_string ="MSSQL:server=.\SQLEXPRESS;<br>
><br>
> database=ObservatoireCommerce;tables=dbo.T_CommuneGeographie;trusted_connec<br>
> tion=yes"<br>
><br>
> >>> qgis.utils.iface.addVectorLayer(conn_string,'test','ogr')<br>
><br>
> 2011/4/12 Yves Jacolin <<a href="mailto:yjacolin@free.fr">yjacolin@free.fr</a>><br>
><br>
> > Christophe,<br>
> ><br>
> > could you test ogr directly to connect to your SQL Server? For example<br>
> > convert<br>
> > sql server layer into shapefile. You will know if this is an ogr or QGIS<br>
> > issue.<br>
> ><br>
> > Y.<br>
> ><br>
> > Le mardi 12 avril 2011 12:39:21, Nathan Woodrow a écrit :<br>
> > > This seems to be a bug, I have noticed it is happens mainly on  Windows<br>
> ><br>
> > XP<br>
> ><br>
> > > but Windows 7 also has this bug.  I'm not sure where the problem is, I<br>
> > > suspect QGIS as OGR via command line returns the correct objects.<br>
> > ><br>
> > > - Nathan<br>
> > ><br>
> > > On Tue, Apr 12, 2011 at 8:16 PM, Christophe B <<a href="mailto:ampouillle@gmail.com">ampouillle@gmail.com</a>><br>
> ><br>
> > wrote:<br>
> > > > Hello List,<br>
> > > ><br>
> > > > I now test the ability to connect to SQL Server data whis GDAL 1.8 of<br>
> > > > QGIS 1.7.<br>
> > > > The connection is correct but I have no geometry in return, and the<br>
> ><br>
> > right<br>
> ><br>
> > > > attribute data (error).<br>
> > > > Is a problem in GDAL / OGR? or QGIS 1.7?<br>
> > > ><br>
> > > > Should we open a new ticket ?<br>
> > > ><br>
> > > > Thank you in advance<br>
> > > ><br>
> > > > Christophe Baume<br>
> > > ><br>
> > > > _______________________________________________<br>
> > > > Qgis-user mailing list<br>
> > > > <a href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a><br>
> > > > <a href="http://lists.osgeo.org/mailman/listinfo/qgis-user" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
> ><br>
> > --<br>
> > Yves Jacolin<br>
> ><br>
> > <a href="http://yjacolin.gloobe.org" target="_blank">http://yjacolin.gloobe.org</a><br>
<br>
</div></div>--<br>
<div class="im">Yves Jacolin<br>
<br>
<a href="http://yjacolin.gloobe.org" target="_blank">http://yjacolin.gloobe.org</a><br>
</div><div><div></div><div class="h5">_______________________________________________<br>
Qgis-user mailing list<br>
<a href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/qgis-user" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
</div></div></blockquote></div><br>