Hi,<br>I'm just starting out with MapServer / MapScript C#. <br><br>I get "Attempted to read or write protected memory" 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 > 0)<br>
{ int shapeInd = result.getResult(0).shapeindex; <br> layer.open();<br> shapeObj shape = layer.getFeature(shapeInd, -1); <<--Attempted to read or write protected memory<br>
<br> string txt = "";<br><br> for (int i = 0; i < shape.numvalues;i++)// layer.numitems; i++)<br> {<br> txt += "<b>"+ layer.getItem(i) +": </b>";<br>
txt += " " + shape.getValue(i) + "<br/>"; <br> } etc.<br></blockquote><br><br>Additional notes:<br>* the tolerance > 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 & 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 "Image handling error. Failed to draw layer..."<br><br>Am doing something wrong - is this the correct way of going about querying & visualizing? Is what I trying to do possible with SQL Server layers?<br>
Any help/pointers appreciated.<br><br>Thanks<br>Will<br>