Community of MapPoint and Virtual Earth Users and Developers
This is a discussion on LinkData and VC++ within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Hello, I am trying to use the LinkData function of a MapPoint DataSets object from c++. I get error "The ...
| |||||||
| Today's Posts | Twitter Feed | Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| LinkData and VC++ I am trying to use the LinkData function of a MapPoint DataSets object from c++. I get error "The parameter is incorrect". With VB it works without problem. Here is a VB code Private Sub ImportData_Click() Dim objMap As MapPointCtl.Map Dim objLoc As MapPointCtl.Location Dim objPushPin As MapPointCtl.Pushpin Dim zDataSource As String Dim Key As String Dim FLArray(1 To 3, 1 To 2) As Variant Dim FLDS As MapPointCtl.DataSet zDataSource = "C:\test.txt" Key = "Name" Set objMap = Form1.MappointControl1.ActiveMap FLArray(1, 1) = 1 '"Name" FLArray(1, 2) = geoFieldName FLArray(2, 1) = 2 '"Latitude" FLArray(2, 2) = geoFieldLatitude FLArray(3, 1) = 3 '"Longitude" FLArray(3, 2) = geoFieldLongitude Set FLDS = objMap.DataSets.LinkData(zDataSource, _ Key, FLArray, , geoDelimiterSemicolon, _ geoImportFirstRowIsHeadings) ' FLDS.ZoomTo End Sub And here a C++ code const long geoImportFirstRowIsHeadings = 0; const long geoImportFirstRowNotHeadings = 1; const long geoDelimiterSemicolon = 59; const long geoCountryGermany = 94; const long geoCountryDefault = 0; const long geoFieldName = 1; const long geoFieldLatitude = 20; const long geoFieldLongitude = 21; SAFEARRAYBOUND saBound[ 2 ] ; saBound[ 0 ].cElements = 3 ; saBound[ 0 ].lLbound = 1; saBound[ 1 ].cElements = 3 ; saBound[ 1 ].lLbound = 1; _variant_t arr; VariantInit(&arr); arr.vt = VT_ARRAY | VT_VARIANT; arr.parray = SafeArrayCreate (VT_VARIANT, 2, saBound);// long idx[ 2 ] ; _variant_t Name;// = (long)1;//"Name"; _variant_t latitude;// = (long)2;//"Latitude"; _variant_t longitude;// = (long)3;//"Latitude"; _variant_t Name_val;// = geoFieldName; _variant_t latitude_val;// = geoFieldLatitude; _variant_t longitude_val;// = geoFieldLongitude; idx[ 0 ] = 1 ; idx[ 1 ] = 1; VERIFY(SafeArrayPutElement(arr.parray, idx, &Name) == S_OK); idx[ 0 ] = 1 ; idx[ 1 ] = 2; VERIFY(SafeArrayPutElement(arr.parray, idx, &Name_val) == S_OK); idx[ 0 ] = 2 ; idx[ 1 ] = 1; VERIFY(SafeArrayPutElement(arr.parray, idx, &latitude) == S_OK); idx[ 0 ] = 2 ; idx[ 1 ] = 2; VERIFY(SafeArrayPutElement(arr.parray, idx, &latitude_val) == S_OK); idx[ 0 ] = 3 ; idx[ 1 ] = 1; VERIFY(SafeArrayPutElement(arr.parray, idx, &longitude) == S_OK); idx[ 0 ] = 3 ; idx[ 1 ] = 2; VERIFY(SafeArrayPutElement(arr.parray, idx, &longitude_val) == S_OK); _variant_t key = "Name"; CDataSets dss = m_MapPoint.GetActiveMap().GetDataSets(); CString zDataSource = "C:\test.txt"; CDataSet ds = dss.LinkData(zDataSource.c_str(), key, arr, geoCountryDefault, geoDelimiterSemicolon, geoImportFirstRowIsHeadings); Any ideas? Thanks Sergej |
![]() |
| Tags |
| linkdata |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Linking LinkData | DrewD | MapPoint 2006/2009 Discussion | 0 | 02-10-2004 10:22 AM |
| Having Problems with LinkData w/ Addresses | mrobold | MapPoint 2006/2009 Discussion | 1 | 11-12-2003 01:36 PM |
| LinkData with UDL file in VB 6 App | Wim | MapPoint 2006/2009 Discussion | 1 | 04-03-2003 06:04 AM |
| I have a VB6 app using LINKDATA to get to a Access.... | Anonymous | MapPoint 2006/2009 Discussion | 3 | 08-06-2002 11:06 PM |
| Is it possible to use the Linkdata() method to con.... | Anonymous | MapPoint 2006/2009 Discussion | 1 | 04-26-2002 08:06 AM |
Madeira Holiday
Why not book a Madeira holiday through UlookUbook and enjoy this warm Portuguese island at a bargain price!