MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




QueryShape problem Please help

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 ...


Go Back   MapPoint Forums > Map Forums > MapPoint 2006/2009 Discussion

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read



Click here to register

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-12-2003
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
QueryShape problem Please help

I have an application to Track Vehicles on the Map. We Draw Shapes with the mouse on the Map to divide the city into zones. The vehicles are created as push pins in a specific DataSet.
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 03-13-2003
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Hi
i'm not much expert about mappoint but it' seems as you fill the memory.
Pheraps you must set to nothing objRecords or unload from the memory the records you don't use again.

bye

Achille
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 03-13-2003
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Quote:
Originally Posted by Anonymous
Hi
i'm not much expert about mappoint but it' seems as you fill the memory.
Pheraps you must set to nothing objRecords or unload from the memory the records you don't use again.

bye

Achille
Thanks for the advise. I have tried that, but it didn't help at all.
Just a quick question, why would the use of Nothing help, when the objRecords ( RecordSet ) is declared locally to a function call?

Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
problem, queryshape


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

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


All times are GMT -5. The time now is 10:49 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
MP2K Magazine
Visitor Map


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54