Community of VE/MapPoint Users and Developers
This is a discussion on QueryShape problem Please help within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; I have an application to Track Vehicles on the Map. We Draw Shapes with the mouse on the Map to ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| QueryShape problem Please help When we Query a Shape, the results are returned Ok. But after peforming the QueryShape several hundred times, MapPoint Crashs. I am attaching some code for review. If this code is called from a for loop statement the error will appear almost within 3-4 minutes: Public Function MapGenerateVehicleInAZoneList(lngZoneNumber As Long) As Boolean Dim TZoneFeature As ZONE_FEATURE Dim blnOk As Boolean Dim strFunctionName As String strFunctionName = vbNewLine & "MapGenerateVehicleInAZoneList" On Error GoTo Err_MapGenerateVehicleInAZoneList blnOk = False If ZDReadZoneRecordFromArray(lngZoneNumber, TZoneFeature) = True Then blnOk = MapGenerateVehiclesWithinAFeatureList(TZoneFeature .oShape) End If Exit_MapGenerateVehicleInAZoneList: MapGenerateVehicleInAZoneList = blnOk Exit Function Err_MapGenerateVehicleInAZoneList: MsgBox Err.Description & strFunctionName Resume Exit_MapGenerateVehicleInAZoneList End Function Public Function MapGenerateVehiclesWithinAFeatureList(oShape As MapPointCtl.Shape) As Boolean Dim TTempVehicleRecord As VEHICALE_RECORD Dim intNumVehiclesFound As Integer Dim intRecordNumber As Integer Dim blnOk As Boolean Dim objRecords As MapPointCtl.Recordset Dim strFunctionName As String strFunctionName = vbNewLine & "MapGenerateVehiclesWithinAFeatureList" On Error GoTo Err_MapGenerateVehiclesWithinAFeatureList blnOk = False intNumVehiclesFound = 0 ReDim TVehicleListReported(1) 'THIS LINE CAUSES THE PROBLEM. AFTER FIXED NUMBER OF CALLS Set objRecords = frmMain.Map1.ActiveMap.DataSets(STR_VEHICLES_PLOT_ DATA_SET).QueryShape(oShape) If objRecords.BOF = False Then objRecords.MoveFirst ' Add results of search to results list box control Do While Not objRecords.EOF If objRecords.Pushpin.Name <> "0" Then If CRGetVehicleRecordNumber(objRecords.Pushpin.Name, intRecordNumber, False) = True Then Call CRReadRecord(intRecordNumber, TTempVehicleRecord) intNumVehiclesFound = intNumVehiclesFound + 1 ReDim Preserve TVehicleListReported(intNumVehiclesFound) TVehicleListReported(intNumVehiclesFound).strVehic leNumber = CStr(objRecords.Pushpin.Name) TVehicleListReported(intNumVehiclesFound).strLastT imeUpdated = RTrim$(TTempVehicleRecord.strLastTimeUpdated) End If End If objRecords.MoveNext Loop End If Call CMNUpdateNumOfVehiclesReported(intNumVehiclesFound ) blnOk = True Exit_MapGenerateVehiclesWithinAFeatureList: MapGenerateVehiclesWithinAFeatureList = blnOk Exit Function Err_MapGenerateVehiclesWithinAFeatureList: MsgBox Err.Description & strFunctionName Resume Exit_MapGenerateVehiclesWithinAFeatureList End Function Please advise |
| |||
| Quote:
Just a quick question, why would the use of Nothing help, when the objRecords ( RecordSet ) is declared locally to a function call? Thanks |
![]() |
| Tags |
| problem, queryshape |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| VB6 error "Method 'QueryShape' of object 'DataSet' fail | David J | MapPoint 2006/2009 Discussion | 2 | 12-07-2005 02:13 PM |
| QueryShape dont work as expected | Bed007 | MapPoint 2006/2009 Discussion | 3 | 10-23-2005 03:39 PM |
| Problem with dataset.QueryShape Method | Ray Liu | MapPoint 2006/2009 Discussion | 1 | 07-15-2004 11:55 AM |
| Huge memory leak in using QueryShape? | random0000 | MapPoint 2006/2009 Discussion | 2 | 03-28-2003 06:22 AM |