Benjamin,<div><br></div><div>What is the content of the geometry_columns metadata table in your database?</div><div><br></div><div>Best regards,</div><div><br></div><div>Tamas</div><div><br></div><div><br><br><div class="gmail_quote">
2012/7/11 Benjamin <span dir="ltr"><<a href="mailto:benjamin.lux@maxsea.fr" target="_blank">benjamin.lux@maxsea.fr</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,

I try to connect my application to a DB with the framework Ogr (with C# warper).
When I write folloing code, Ogr methods view the DB but can't read it.

[code]
            Ogr.RegisterAll();

            const string connectionString = @"Server=SERVEUR_NAME;Database=DATABASE_NAME;trusted_connection=yes";

            DataSource pnn3 = Ogr.Open("MSSQL:" + connectionString, 0);
            if (pnn3 == null)
                       throw new IOException("Creation of output file failed.");
            
            Console.WriteLine("pnn3.Name\t=" + <a href="http://pnn3.name" target="_blank">pnn3.name</a>);
            Console.WriteLine("pnn3.GetLayerCount()\t= " + pnn3.GetLayerCount());
[/code]

It display :
[quote]
Server=SERVEUR_NAME;Database=DATABASE_NAME;trusted_connection=yes
0
[/quote]

I know my DB is view because if I switch SERVEUR_NAME and/or DATABASE_NAME by an other name the exception is throwed
On the other hand driver don't see my layers (it displays 0, and my db has near to 30 layers).

If someone have already connected to db MSSQL, can him suggests me an example of code (in C or C++ it is also great, it may help me) ?

Notes:
I use gdal-1.9.0 (with MSSQL Driver)
link usefull : <a href="http://www.gdal.org/ogr/drv_mssqlspatial.html" rel="nofollow" link="external" target="_blank">MSSQLSpatial - Microsoft SQL Server Spatial Database</a>

Best regards,
Benjamin.
        
<br><hr align="left" width="300">
View this message in context: <a href="http://osgeo-org.1560.n6.nabble.com/gdal-dev-Ogr-to-access-MSSQL-DB-tp4987592.html" target="_blank">[gdal-dev] Ogr to access MSSQL DB</a><br>
Sent from the <a href="http://osgeo-org.1560.n6.nabble.com/GDAL-Dev-f3742093.html" target="_blank">GDAL - Dev mailing list archive</a> at Nabble.com.<br><br>_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br></blockquote></div><br></div>