Hi,<br>I&#39;m just starting out with MapServer / MapScript C#. <br><br>I get &quot;Attempted to read or write protected memory&quot; when trying to retrieve the shape of the selection in a SQL Server layer. Code snippet below (adapted from example code):<br>
<br><blockquote>    if (layer.queryByPoint(Map, point, mapscript.MS_SINGLE, tolerance) == (int)MS_RETURN_VALUE.MS_SUCCESS)       {<br>                        resultCacheObj result = layer.getResults();<br>                        if (result.numresults &gt; 0)<br>
                        {   int shapeInd = result.getResult(0).shapeindex;                       <br>                            layer.open();<br>                            shapeObj shape = layer.getFeature(shapeInd, -1); &lt;&lt;--Attempted to read or write protected memory<br>
<br>    string txt = &quot;&quot;;<br><br>    for (int i = 0; i &lt; shape.numvalues;i++)// layer.numitems; i++)<br>                            {<br>                               txt += &quot;&lt;b&gt;&quot;+ layer.getItem(i) +&quot;: &lt;/b&gt;&quot;;<br>
                                txt += &quot; &quot; + shape.getValue(i) + &quot;&lt;br/&gt;&quot;;                          <br>                            }  etc.<br></blockquote><br><br>Additional notes:<br>* the tolerance &gt; 0<br>
* IIS 5 <br>* using latest build (MSVC2008 (Win32) -stable release-1500-gdal-1-6-mapserver-5-6.zip) DLLs (including msplugin_mssql2008.dll)<br>* VS 2008 project<br>* the SQL Server layer geometry is points &amp; draws without problems<br>
* code works for other layers in may map<br><br>Additional issue:<br>When doing a queryByShape on the SQL Server layer and try drawQuery on the map I get &quot;Image handling error. Failed to draw layer...&quot;<br><br>Am doing something wrong - is this the correct way of going about querying &amp; visualizing? Is what I trying to do possible with SQL Server layers?<br>
Any help/pointers appreciated.<br><br>Thanks<br>Will<br>