Updating SDF File

To demonstrate how to open, navigate, and edit a SDF (SQL Server Compact Edition Database) file within the built-in tds database, we are going to outline how you can update an event layer attribute that is attached to a default lrs template for a specific profile.

  1. Load the profile you want to edit and find out what the default lrs template is.
    1. Select More from the top navigation menu.
    2. Select Application Configuration.
    3. Scroll down to the Default Template setting and make note of the name.
  2. ID for template – restful endpoints via API navigation on tds page Lrs profile endpoints – through this find default template id #
  3. By appending api endpoint with template id #, gain further knowledge about layer, such as: available network layers and event layer.
  4. You want to edit the “from_measure” field name for one of the event layers.

There are various tools to view and edit sdf files. For this demonstration, we will be using Visual Studio add-in called SQL Server compact and SQL lite toolbox (SqlCe Toolbox), which is available for free through Visual Studio gallery or GitHub.

  1. Open Visual Studio.
  2. Go to Tools.
  3. Select SQL Server Compact/Lite Toolbox.
  4. Right-click data connection to add a connection
  5. For the File name" select Browse to find where tds is installed.
  6. Choose the app data folder
  7. Inside the folder you will see a sdf file called “tds," select this file.
  8. Click Open.
  9. Test the connection created.
  10. Click Ok.

    Note: The next time you open the toolbox, you will see this connection inside the list.

  11. Select the connection you just made.
  12. All data tables associated with this database will be listed; including: ra profiles, list of profile and template ids, event layers.
  13. To sort the list, run a query or look for the lrs profile id you are interested in editing.
  14. Run a query to get the ids for the event layers: go to map server.
  15. Select event layers.
  16. Confirm the current From_Measure is incorrect.
  17. Right-click on the table you want to query.
  18. Open a blank prompt to write your query.
  19. Update the event layers table to set the From_Measure field name value, but only if lrs profile id is the one found and the map layer ids are the ones previously searched for.
  20. Run your query to find the rows affected.