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