I am trying to import a comma delimited text file into a mappoint dataset using C#

The columns and summary data of the txt file are

LinkID, MapID, Long1, Lat1, Long2, Lat2
7871,1,-2.98654,56.4529,-2.09585,57.1432
7872,26,-2.98654,56.4529,-2.09585,57.1432
7873,27,-2.98654,56.4529,-2.09585,57.1432
7874,28,-2.98654,56.4529,-2.09585,57.1432
7875,29,-2.98654,56.4529,-2.09585,57.1432
7876,30,-2.98654,56.4529,-2.09585,57.1432
7877,34,-2.98654,56.4529,-2.09585,57.1432
7878,41,-2.98654,56.4529,-2.09585,57.1432
7879,53,-2.98654,56.4529,-2.09585,57.1432
7880,86,-2.98654,56.4529,-2.09585,57.1432

I have written the following code



MapPointApp.Map oMap;
//Create an application class
MapPointApp.ApplicationClass app = null;
app = new MapPointApp.ApplicationClass();
MapPointApp.DataSet oDataSet = null;


try

{


string sDataPath = Path.GetDirectoryName(System.Windows.Forms.Applica tion.ExecutablePath) + Path.DirectorySeparatorChar +"Tlinks.txt";



object[,] aGrid = new object[6,2];


aGrid.SetValue( "LinkID", 0, 0 );
aGrid.SetValue( MapPointApp.GeoFieldType.geoFieldData, 0, 1 );
aGrid.SetValue( "MapID", 1, 0 );
aGrid.SetValue( MapPointApp.GeoFieldType.geoFieldData, 1, 1 );
aGrid.SetValue( "Long1", 2, 0 );
aGrid.SetValue( MapPointApp.GeoFieldType.geoFieldLongitude, 2, 1 );
aGrid.SetValue( "Lat1", 3, 0 );
aGrid.SetValue( MapPointApp.GeoFieldType.geoFieldLatitude , 3, 1 );
aGrid.SetValue( "Long2", 4, 0 );
aGrid.SetValue( MapPointApp.GeoFieldType.geoFieldLongitude, 4, 1 );
aGrid.SetValue( "Lat2", 5, 0 );
aGrid.SetValue( MapPointApp.GeoFieldType.geoFieldLatitude , 5, 1 );

oDataSet = app.ActiveMap.DataSets.ImportData(sDataPath,aGrid,

MapPointApp.GeoCountry.geoCountryUnitedKingdom ,

0,0);

If I simply use

LinkID, MapID, Long, Lat as the column headers and the importdata method without the array

I do not get any errors and the code works fine

If anyone has any ideas why this does not work (mappoint throws an internal error) , i would be grateful

Thanks

Richard