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 6 of 6

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

This is a discussion on DataSet.Paste: Exception from HRESULT: 0x80040E04 (vb.NET) within the MapPoint Desktop Discussion forums, part of the Map Forums category; Below is a code snippet that takes lat/lon data from a database and plots it on MapPoint 2004. This sub ...

  1. #1
    thomas is offline Junior Member White Belt
    Join Date
    Sep 2004
    Posts
    5

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

    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

  2. #2
    thomas is offline Junior Member White Belt
    Join Date
    Sep 2004
    Posts
    5
    Anyone seen this error before? Suggestions on catching it and recovering?

    Thomas

  3. #3
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433
    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.

  4. #4
    citrix_99301's Avatar
    citrix_99301 is offline Junior Member Yellow Belt
    Join Date
    Mar 2006
    Posts
    17

    Exception from HRESULT: 0x80040E04

    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();

  5. #5
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433
    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 ...

  6. #6
    liam_web is offline Junior Member White Belt
    Join Date
    Jan 2009
    Posts
    1

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

    you can find here dataset help

    VB.NET ADO.NET Dataset Tutorial

    liam.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. OutOfMemory Exception
    By Gianmaria in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 01-24-2006, 01:26 PM
  2. Regarding COM exception at the end of execution...
    By Anonymous in forum MP2K Magazine Articles
    Replies: 0
    Last Post: 05-12-2005, 01:23 PM
  3. Cut and Paste Problem with Word 2003 and MapPoint 2004
    By brubli in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 10-21-2004, 05:26 PM
  4. Dataset Copy/Paste
    By indmillert in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 11-10-2003, 05:10 PM
  5. Problems with copy and paste of user-defined territories
    By Ute in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 04-14-2003, 12:38 PM

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 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 55 56 57 58 59 60 61 62 63 64 65 66