MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




LinkData and VC++

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 ...


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

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



Click here to register

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-07-2003
Junior Member
White Belt
 
Join Date: Sep 2002
Posts: 1
LinkData and VC++

Hello,
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
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
linkdata


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
Linking LinkData DrewD MapPoint 2006/2009 Discussion 0 02-10-2004 11:22 AM
Having Problems with LinkData w/ Addresses mrobold MapPoint 2006/2009 Discussion 1 11-12-2003 02:36 PM
LinkData with UDL file in VB 6 App Wim MapPoint 2006/2009 Discussion 1 04-03-2003 07:04 AM
I have a VB6 app using LINKDATA to get to a Access.... Anonymous MapPoint 2006/2009 Discussion 3 08-07-2002 12:06 AM
Is it possible to use the Linkdata() method to con.... Anonymous MapPoint 2006/2009 Discussion 1 04-26-2002 09:06 AM


All times are GMT -5. The time now is 10:19 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
MP2K Magazine
Visitor Map


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