DataSet.Paste: Exception from HRESULT: 0x80040E04 (vb.NET)

thomas
03-04-2005, 02:31 PM
Below is a code snippet that takes lat/lon data from a database and plots it on MapPoint 2004. This sub randomly returns the error message "HRESULT 0x80040E04". I have pulled all I can from the exception object:

Method: Paste
StackTrace: at MapPoint.DataSet.Paste()
Message: Exception from HRESULT: 0x80040E04

Has anyone seen this before? Any suggestions?

Thanks,
Thomas

Dim oMap As MapPoint.Map
Dim oLoc As MapPoint.Location
Dim oPushpin As MapPoint.Pushpin
Dim oDS As MapPoint.DataSet
Dim oRoute As MapPoint.Route

'Query Database
sdst = SqlHelper.ExecuteDataset(UserSettings.ConnString, "getMobileHistory", SqlHelper.ExecuteScalar(UserSettings.ConnString, "getMobileIDFromName", Mobile), CDate(dt1.Text & " " & dt2.Text), CDate(dt3.Text & " " & dt4.Text), eList)

'Initialize MapPoint objects
oMap = Map.MapCtl.ActiveMap
oMap.Saved = True
oRoute = oMap.ActiveRoute

'Set Up Map for pushpin dataset
oMap.DataSets.AddPushpinSet(Mobile)
oDS = oMap.DataSets(Mobile)
oDS.Symbol = 256
oDS.Select()

'cycle through DataSet
For jj = 0 To sdst.Tables(0).Rows.Count - 1
latitude = sdst.Tables(0).Rows(jj).Item(2)
longitude = sdst.Tables(0).Rows(jj).Item(3)
oLoc = oMap.GetLocation(latitude, longitude, 1)
oRoute.Waypoints.Add(oLoc, CStr(i + 1))
oPushpin = oMap.AddPushpin(oLoc)
oPushpin.Note = "Vehicle: " & Mobile & vbNewLine & _
"Time: " & LogTime & vbNewLine & _
"Event: " & EventName & vbNewLine & _
"Heading: " & Heading & vbNewLine & _
"Speed: " & Speed & vbNewLine
oPushpin.Name = i
oPushpin.Symbol = symbol
oPushpin.Cut()
oDS.Paste()
i = i + 1
Next

thomas
03-09-2005, 03:57 PM
Anyone seen this error before? Suggestions on catching it and recovering?

Thomas

Wilfried
03-10-2005, 09:57 AM
Hi,

Difficult to say. But.. there is no such thing as 'random error' in software. It will happen in a certain condtion. However with a loose pointer it can be more or less random (in time).

You have to find out first witch line of code is the offending one. Then when you know that you can search for the differences.

citrix_99301
03-10-2006, 10:37 AM
Hi,

I'm getting the same "seemingly random" error when the program attempts to build a recordset out of all the pushpins in a dataset.

If the user tries the same exact thing, the next time it's likely to go through with no problems.

Does anybody have any ideas?

Andre Ranieri



oRS = oDS.QueryAllRecords();

Wilfried
03-14-2006, 02:09 PM
Hi,

I never had this error, but from what I see in the message: HRESULT, is telling me that Result is a windows handle. So could be that a certain handle is overwritten, or used by another thread (if your program is multithread).

I always liked to debug the 'seemignly random' errors from colleguas of me, to show them that there is no sutch thing as 'random' :) But I have to cofess it is somethime difficult...

To begin with if you have multiple threads, go single thread and see if you have still the same problem. Then simplify until you have a demo with no more code to show the problem. By then you probably have found it yourself, but pleas feedback here :)

Sorry but that is really all the help I can give ...

 
Web mp2kmag.com
mapforums.com