Share via


Add Find Nearby Categories

The Add Find Nearby Categories sample is a command-line tool that can you can use to import Find Nearby categories from an XML file to Microsoft® MapPoint® Location Server. Additionally, you can export Find Nearby categories from MapPoint Location Server to an XML file.

Running the Sample in Visual Studio .NET 2003

Note  To run this sample, install the Microsoft MapPoint Location Server Management API assemblies along with Microsoft .NET Framework version 1.1 on your development computer. For more information about requirements, see MapPoint Location Server Application Development Requirements.

To run the sample

  1. In Microsoft Visual Studio® .NET, on the File menu , point to New, and then click Project.

  2. In the left pane of the New Project dialog box, click Visual Basic Projects or Visual C# Projects project type, and then click the Console Application template.

  3. In Name, change ConsoleApplication to FindNearbyUtility, and then click OK.

  4. On the Project menu, click Add Existing Item.

  5. Navigate to the appropriate project subfolder in the FindNearby Utility folder, select All Files in the Files of type dialog box, and then select all of the available files.

    • The default location for Visual Basic .NET project files is:
      Program Files\Microsoft MapPoint Location Server SDK, Version 1.0\Samples\Command Line Tools\FindNearby Utility\vb.
    • The default location for Visual C# .NET project files is:
      Program Files\Microsoft MapPoint Location Server SDK, Version 1.0\Samples\Command Line Tools\FindNearby Utility\cs.

    Note  When prompted, replace any existing files.

  6. Delete the default class (Class1.cs in Visual C# and Module1.vb in Visual Basic .NET) from the project.

  7. On the Project menu, click Add Existing Item.

  8. Navigate to the appropriate project subfolder in the Utility Base folder, select All Files in the Files of type box, and then select all of the available files.

    • The default location for Visual Basic .NET project files is:
      Program Files\Microsoft MapPoint Location Server SDK, Version 1.0\Samples\Utility Base\VB
    • The default location for Visual C# .NET project files is:
      Program Files\Microsoft MapPoint Location Server SDK, Version 1.0\Samples\Utility Base\CS

    Note  When prompted, replace any existing files.

    Note  You can reuse these base classes if you develop another command-line utility.

  9. In Solution Explorer, right-click References and then click Add Reference.

  10. In AddReference, click Browse, and add the following assemblies:

    • Microsoft.MapPoint.LocationServer.Management.dll
    • Microsoft.MapPoint.LocationServer.Types.dll
    • Microsoft.MapPoint.LocationServer.Core.dll
  11. To debug the sample, in Solution Explorer, right-click the project, and then click Properties.

  12. In the FindNearbyUtility Property Pages dialog box, select the Configuration Properties folder.

  13. Click Debugging.

  14. Under Start Options, in Command Line Arguments, type the command line for the action that you want to perform:

    To import Find Nearby categories, type /load:myXml.xml /culture:en-US /server:SQL-SERVER-NAME /db:DATABASE-NAME

    To export Find Nearby categories, type /unload:myXml.xml /culture:en-US /server:SQL-SERVER-NAME /db:DATABASE-NAME

    The following illustrations show the Command Line Argument field.

    Command Line Argument field for a Visual C# .NET project.

    Command Line Argument field for a Visual Basic .NET project.

  15. To begin the debugging process, on the Debug menu, click Start.

  16. Alternatively, you can run this from the command line and type FindNearbyUtility.exe /? for Help.

See Also

Sample Code