MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Passing a VARIANT for LinkData() method using VC++

This is a discussion on Passing a VARIANT for LinkData() method using VC++ within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Hi I want to link data over the LinkData() method using a variant as a pointer to my data as ...


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-11-2006
Junior Member
Yellow Belt
 
Join Date: Jun 2006
Posts: 13
Passing a VARIANT for LinkData() method using VC++

Hi
I want to link data over the LinkData() method using a variant as a pointer to my data as described on the Microsoft website.

I have stored data in an Excel file and whish to have it mapped. First column contains the region names, second column contains my personal data to be mapped.

The following code will not do:

VARIANT PrimaryKeyField;
VariantInit(&PrimaryKeyField);
PrimaryKeyField.vt=VT_I4;
PrimaryKeyField.lVal=0; // The first column is the Key Field (the names of the regions)

VARIANT arr;
arr.vt=VT_ARRAY | VT_VARIANT;

SAFEARRAYBOUND bound = {2,0}:
arr.parray=SafeArrayCreate(VT_I4,1,&bound);

long x=0;
long val=1; // The value for GeoFieldName is 1 (first column)
SafeArrayPutElement(arr.parray,&x,&val);

x++;
val=23; // The value for GeoFieldData is 23 (second column)
SafeArrayPutElement(arr.parray,&x,&val);

CDataSet DataSet
= m_map.GetDataSets().LinkData(filename.xls,PrimaryK eyField,arr,244,0,0):


The country code for USA is 244, Delimiter and ImportFlags are both 0 (default).

What is going wrong? Thanks in advance
Geouser







PrimaryKeyField.lVal=0; // The first column is the Key Field
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 07-15-2006
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,112
Re: Passing a VARIANT for LinkData() method using VC++

Hi,

Quote:
The following code will not do
Can you tell us what exacly is working or not working, do you have errors / exceptions ?
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, method, passing, variant


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
C++ and passing Variant Arrays Anonymous MapPoint 2006/2009 Discussion 8 12-20-2007 08:06 AM
Linking LinkData DrewD MapPoint 2006/2009 Discussion 0 02-10-2004 11:22 AM
How can i find address by passing Lat/Lon as parameter? joesebi MapPoint 2006/2009 Discussion 1 07-09-2003 10:10 AM
LinkData and VC++ sowtschi MapPoint 2006/2009 Discussion 0 07-07-2003 10:32 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 01:11 PM.


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