Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Results 1 to 3 of 3

QueryShape problem Please help

This is a discussion on QueryShape problem Please help within the MapPoint Desktop 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 ...

  1. #1
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137

    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

  2. #2
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    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

  3. #3
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. VB6 error "Method 'QueryShape' of object 'DataSet' fail
    By David J in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 12-07-2005, 01:13 PM
  2. QueryShape dont work as expected
    By Bed007 in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 10-23-2005, 02:39 PM
  3. Problem with dataset.QueryShape Method
    By Ray Liu in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 07-15-2004, 10:55 AM
  4. Huge memory leak in using QueryShape?
    By random0000 in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 03-28-2003, 05:22 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


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