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

Exception thrown importing data (using c#)

This is a discussion on Exception thrown importing data (using c#) within the MapPoint Desktop Discussion forums, part of the Map Forums category; Hi, I tried searching for this exception but couldn't find anything. I'm trying to import a list of airports into ...

  1. #1
    MS4246 is offline Junior Member White Belt
    Join Date
    Feb 2005
    Posts
    3

    Exception thrown importing data (using c#)

    Hi,

    I tried searching for this exception but couldn't find anything. I'm trying to import a list of airports into mappoint using C# and the call to import data throws an exception:

    An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in MapPointTestApplication.exe
    Additional information: Cannot import data because no columns were found.

    Any help would be greatly appreciated.
    Thank you,

    Mitu

    My Code:
    DataSets dataSets = ActiveMap.DataSets;

    object [,] arrFields = new object[7, 2];

    arrFields[0, 0] = "Name";
    arrFields[0, 1] = GeoFieldType.geoFieldName;
    arrFields[1, 0] = "";
    arrFields[1, 1] = GeoFieldType.geoFieldSkipped;
    arrFields[2, 0] = "Latitude";
    arrFields[2, 1] = GeoFieldType.geoFieldLatitude;
    arrFields[3, 0] = "Longitude";
    arrFields[3, 1] = GeoFieldType.geoFieldLongitude;
    arrFields[4, 0] = "";
    arrFields[4, 1] = GeoFieldType.geoFieldSkipped;
    arrFields[5, 0] = "";
    arrFields[5, 1] = GeoFieldType.geoFieldSkipped;
    arrFields[6, 0] = "";
    arrFields[6, 1] = GeoFieldType.geoFieldSkipped;

    dataSets.ImportData(strFileName, arrFields, GeoCountry.geoCountryUnitedStates,
    GeoDelimiter.geoDelimiterTab, GeoImportFlags.geoImportFirstRowNotHeadings);

    And my file sample (tab delimited, 7 columns):

    AAF US 29.733333333333 -85.033333333333 Apalachicola, FL America/New_York Apalachicola Municipal

  2. #2
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    I dont know if this is a problem or not, but when I import data sets, I create a dataset to import it into.

    For example,
    Code:
    DataSet DS;
    
    DS = dataSets.ImportData(strFileName, arrFields, GeoCountry.geoCountryUnitedStates, 
    GeoDelimiter.geoDelimiterTab, GeoImportFlags.geoImportFirstRowNotHeadings);
    That has always worked for me, but Ive never used a tab seperated file before. Also, and Im not sure about this either, but I think that when you use an array of fields, you are telling it what the name of the column you are importing from is called, so since you don't have any column names, that might be a problem.

  3. #3
    MS4246 is offline Junior Member White Belt
    Join Date
    Feb 2005
    Posts
    3
    Thanks for that suggestion! I added the column headings to the file and changed tabs to semicolons and it worked like a charm.

    Thanks again,

    Mitu

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Importing Data
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 10-06-2003, 11:27 PM
  2. Help with Mappoint importing data with data ranges
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 08-31-2003, 11:28 AM
  3. Importing data to Mappoint
    By gsully in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 06-25-2003, 03:50 AM
  4. Importing Data
    By Anonymous in forum Wish List
    Replies: 0
    Last Post: 10-05-2002, 12:49 PM
  5. Importing new GIS data and querying it.
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 09-26-2002, 09:29 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