PDA

View Full Version : Create Territory Type Dataset from SQL?



kimballjohnson
11-08-2008, 03:28 AM
I sort of understand the DataSet.ImportData and DataSet.ImportTerritories methods.

However, I have discovered (I think all) the very few examples showing how create a 'data' DataSet programmatically from a SQL database.

You iterate through the sql data and add a location to dataset by doing a Map.AddPushpin(location) call followed by a Pushpin.Moveto(dataset) call.

This is from Mr. Thota's archaic book about programming MapPoint.

However this example is enormously sketchy in its details as all MapPoint examples seem to be.

However, the example of code from Mr. Thota's book is the only example i can find 'normal' coding using a database. Everything else is for coding MS Office Automation solutions.

And this code example handles none of the important features of a DataSet that makes them interesting or valuable.

The DataSet methods that import files, Worksheets or Access tables all allow you to define the columns and types of the data. Those features seem to be necessary for showing Data on maps and for analyzing data in a geo-oriented way inside a DataSet.

That is, you cannot set those properties as you add data to a DataSet in code in a record-by-record manner.

The biggest clue is the fact that the DataSet Properties are all READ ONLY. Therefore the important properties can only be set by the DataSet.ImportData and DataSet.ImportTerritories methods.

So...

Can anyone verify the following?

1. DataSets created by adding locations or pushpins can only be used to display pushpin maps?

2. Territory DataSets can only be created by importing physical Files, Worksheets and Access tables (things named in the DataSourceMoniker parameter)???

3. I'm a dead duck if my future hangs on being able to manage Territories if my data is in a database and I don't want to read data from the database and then create a temporary CSV file to read in the data using the ImportTerritories method that can only accept a 'moniker'.

Thanks,

Kimball

Auge_Ohr
11-11-2008, 01:53 AM
hi,

while there is no Answer, it might be nobody understand you Question ?

im still a Newbie but i try to Answer



1. DataSets created by adding locations or pushpins can only be used to display pushpin maps?

what else shoud a PushPin do ?
you can get PushPin:Location(), use FindNearby() or make a Waypoint from
it but it is still a PushPin.



2. Territory DataSets can only be created by importing physical Files, Worksheets and Access tables (things named in the DataSourceMoniker parameter)???

im not shure what your Dataset "countain" ? what you want "to do" with
it in Mappoint ?



3. I'm a dead duck if my future hangs on being able to manage Territories if my data is in a database and I don't want to read data from the database and then create a temporary CSV file to read in the data using the ImportTerritories method that can only accept a 'moniker'.

the activeX Way "is" the Way to do it, but you must not "import" hole Data
again ... only on a "empty" Map.

so "my Way" 1st to create a Map with all PushPin from my Customer where
i use Customer-ID as "Name" for PushPin. If i need to "update" a PushPin
i use activeX Methode FindPushPin(Customer-ID) to find is PushPin to
"update" Data.

hope i have understand you Question.
greetings by OHR
Jimmy

kimballjohnson
11-20-2008, 01:08 AM
Mr. Ohr,

thanks for taking time to respond.

My questions are about the methods for adding items to MapPoint.DataSet objects that are available in the MapPoint API.

Looking at C. Thota's book, 'Programming Mappoint in C#', i see this:

add data from an Excel Spreadsheet:

MapPoint.DataSet dataset =
map.DataSets.ImportData(filePath, fieldSpecifications, MapPoint.GeoCountry.geoCountryUnitedStates,
MapPoint.GeoDelimiter.geoDelimiterDefault,
MapPoint.GeoImportFlags.geoImportExcelSheet);

add data from an Access database:

MapPoint.DataSet dataset =
map.DataSets.ImportData(filePath, missing,
MapPoint.GeoCountry.geoCountryUnitedStates,
MapPoint.GeoDelimiter.geoDelimiterDefault,
MapPoint.GeoImportFlags.geoImportAccessTable);

add data from SQL Server:

MapPoint.DataSet dataset = map.DataSets.AddPushpinSet("NorthWind Orders");


Please notice that adding from SQL server can only create a dataset composed of pushpins.

This means that the column data is not available. i think that information is necessary for selecting the Territories, such as the ZIP CODE layer in MapPoint.


Am I correct in assuming that the MapPoint API can not be used with a SQL Database EXCEPT for creating datasets composed of PushPins?

thanks,

kimball