MapPoint Forums

MapForums

Community of MapPoint and Virtual Earth Users and Developers




Run-time error 'Method 'UpdateLink' object 'DataSet' failed

This is a discussion on Run-time error 'Method 'UpdateLink' object 'DataSet' failed within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Hello, I created test program with MapPoint 2004. My program is using txt file to create DataSet, after that reading ...


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

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



Click here to register

Reply

 

LinkBack (1) Thread Tools Display Modes
  1 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 09-18-2003
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Run-time error 'Method 'UpdateLink' object 'DataSet' failed

Hello,

I created test program with MapPoint 2004. My program is using txt file to
create DataSet, after that reading Access DB with X and Y and update this
txt file, next step is updating Location of pushpin on Map with UpdateLink
method of object DataSet. After around 990 records the program has run-time error -2147190772 "Method 'UpdateLink' of object 'DataSet' failed". Can you tell me please, what I am doing wrong?

VC


Private Sub cmdImportMsg_Click()
Dim adoMessage As ADODB.Recordset
Dim db As ADODB.Connection
Dim PW As String
Dim numMessage As Long
Const adoOpenStr = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source="
Set db = New ADODB.Connection
Set adoMessage = New ADODB.Recordset
MappointControl1.ActiveMap.Altitude = 100
db.Open adoOpenStr & App.Path & "\msglog.mdb"
adoMessage.Open "Select * from Logs", db, adOpenStatic, adLockOptimistic
If adoMessage.RecordCount <> 0 Then
adoMessage.MoveFirst
Do While Not adoMessage.EOF
DoEvents
If adoMessage.Fields("Longitude") <> 0 And
adoMessage.Fields("Latitude") <> 0 Then
Call KeepInTextFile(1, 1, adoMessage.Fields("Longitude"),
adoMessage.Fields("Latitude"))
MappointControl1.ActiveMap.DataSets("Filtered").Up dateLink
numMessage = numMessage + 1
End If
txtMsg.Text = numMessage
adoMessage.MoveNext
Loop
End If
db.Close
adoMessage.Close
Set adoMessage = Nothing
Set db = Nothing
End Sub

Private Sub Form_Load()
'// Creates a new map. You must specify either the map region
'// (geoMapEurope or geoMapNorthAmerica) to open the default template
for
'// that region or a file name of a template to use for the new map.

Me.MappointControl1.NewMap geoMapNorthAmerica
ShowAll
End Sub
Private Sub Form_Unload(Cancel As Integer)
'// Any changes,including zooming and panning, made to the map causes
'// this the ActiveMap.Saved to be set to false and the end user will be
'// prompted by the MapPoint engine to see if they want to save the
changed
'// map. Setting it to true will eliminate this prompt but the map file
'// will also not contain any of the changes made.

MappointControl1.ActiveMap.Saved = True

End Sub
Public Sub KeepInTextFile(TmpInt As Integer, nameTab As String, x1 As
Double, y1 As Double)
Dim x As Integer
Dim strLine() As String
Dim n As Integer

ReDim Preserve strLine(2)
strLine(0) = "UnitID, Longitude, Latitude"
strLine(1) = nameTab & "," & y1 & "," & x1
Open App.Path & "\" & TmpInt & "Logs.txt" For Output As #1
For n = 0 To UBound(strLine) - 1
Print #1, strLine(n)
Next
Close #1
End Sub
Public Sub ShowAll()
Dim objRecordset As MapPointCtl.Recordset
Dim objDataSets As MapPointCtl.DataSets
Dim objDataSet As MapPointCtl.DataSet
Dim FilePathAndName As String
Dim arArray As Variant
Dim myExampleArray(1 To 3, 1 To 2) As Variant

'// Get the DataSets collection
Set objDataSets = MappointControl1.ActiveMap.DataSets
If DSExist(CStr("Filtered")) Then
objDataSets.Item("Filtered").Delete
End If

'//Field is specified by name
myExampleArray(1, 1) = "UnitId"
'//tells MapPoint to use this field as the Name field
myExampleArray(1, 2) = geoFieldName


myExampleArray(2, 1) = "LastLatitude"
'//tells MapPoint to use this field as the latitude field
myExampleArray(2, 2) = geoFieldLatitude

'//Field again specifed by name
myExampleArray(3, 1) = "LastLongitude"
'//tells MapPoint to use this field as the longitude field
myExampleArray(3, 2) = geoFieldLongitude


'// Change the mousepointer
Screen.MousePointer = vbHourglass
Set objDataSet = objDataSets.LinkData(App.Path & "\1Logs.txt", "UnitID",
, geoCountryCanada, geoDelimiterComma)
objDataSet.Symbol = 83
objDataSet.Name = "Filtered"
Set objRecordset = objDataSet.QueryAllRecords
arArray = Array(objDataSet.Fields(1))

'Set which fields will be visible in the Pushpin balloon
objDataSet.SetFieldsVisibleInBalloon arArray
'objDataSet.
objRecordset.MoveFirst
Do Until objRecordset.EOF
objRecordset.Pushpin.BalloonState = geoDisplayName
objRecordset.MoveNext
Loop
objDataSet.ZoomTo
objDataSet.FieldNamesVisibleInBalloon = True

'// Change the mousepointer
Screen.MousePointer = vbNormal

Set objDataSet = Nothing
Set objRecordset = Nothing
End Sub
Function DSExist(nameDS As String) As Boolean
Dim countDS As Integer
Dim foundDS As Boolean
foundDS = False
For countDS = 1 To MappointControl1.ActiveMap.DataSets.Count
If MappointControl1.ActiveMap.DataSets(countDS).Name = nameDS Then
foundDS = True
Exit For
End If
Next
DSExist = foundDS
End Function
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
dataset, error, failed, method, object, runtime, updatelink


LinkBacks (?)
LinkBack to this Thread: http://www.mapforums.com/run-time-error-method-updatelink-object-dataset-failed-1905.html

Posted By For Type Date
Versão traduzida de http://www.mapforums.com/run-time-error-method-updatelink-object-dataset-failed-1905.html This thread Refback 06-18-2007 01:21 PM

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 01:13 PM
Random Link update failed error when doing UpdateLink method stephenmillington MapPoint 2006/2009 Discussion 4 11-01-2005 03:49 AM
Assertion failed error Radar MapPoint 2006/2009 Discussion 2 10-01-2005 04:35 AM
Mappoint Failed to load error starbuck MapPoint 2006/2009 Discussion 5 11-08-2004 05:37 PM
UpdateLink method Maverick MapPoint 2006/2009 Discussion 1 04-14-2003 01:21 AM


All times are GMT -5. The time now is 11:41 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0 RC2
MP2K Magazine
Visitor Map

Antalya Holiday
Check out the Antalya holiday options through UlookUbook and find amazing offers that suit your pocket...



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