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

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

This is a discussion on Passing a VARIANT for LinkData() method using VC++ within the MapPoint Desktop 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 ...

  1. #1
    geouser is offline 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

  2. #2
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433

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

    Hi,

    The following code will not do
    Can you tell us what exacly is working or not working, do you have errors / exceptions ?

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. C++ and passing Variant Arrays
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 8
    Last Post: 12-20-2007, 08:06 AM
  2. Linking LinkData
    By DrewD in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 02-10-2004, 11:22 AM
  3. How can i find address by passing Lat/Lon as parameter?
    By joesebi in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 07-09-2003, 10:10 AM
  4. LinkData and VC++
    By sowtschi in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 07-07-2003, 10:32 AM
  5. Is it possible to use the Linkdata() method to con....
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 04-26-2002, 09:06 AM

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 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96