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.
- Load the profile you want to edit and find out what the default lrs template is.
- Select More from the top navigation menu.
- Select Application Configuration.
- Scroll down to the Default Template setting and make note of the name.
- ID for template – restful endpoints via API navigation on tds page Lrs profile endpoints – through this find default template id #
- By appending api endpoint with template id #, gain further knowledge about layer, such as: available network layers and event layer.
- 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.
- Open Visual Studio.
- Go to Tools.
- Select SQL Server Compact/Lite Toolbox.
- Right-click data connection to add a connection
- For the File name" select Browse to find where tds is installed.
- Choose the app data folder
- Inside the folder you will see a sdf file called “tds," select this file.
- Click Open.
- Test the connection created.
- Click Ok.
Note: The next time you open the toolbox, you will see this connection inside the list.
- Select the connection you just made.
- All data tables associated with this database will be listed; including: ra profiles, list of profile and template ids, event layers.
- To sort the list, run a query or look for the lrs profile id you are interested in editing.
- Run a query to get the ids for the event layers: go to map server.
- Select event layers.
- Confirm the current From_Measure is incorrect.
- Right-click on the table you want to query.
- Open a blank prompt to write your query.
- 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.
- Run your query to find the rows affected.