Search code examples
lightswitch-2013

How do I view LightSwitch database data in Visual Studio?


I have added data to a table and I want to delete or edit it without creating a view screen.

How can I view data in a table of a LightSwitch database inside Visual Studio in debug mode?

There is no option for viewing table data when right clicking an lsml file. I also tried adding a new connection in the server explorer using a Microsoft SQL server database file and choosing bin/data/ApplicationDatabase.mdf, but I got the error: "The file is in use." Closing the solution in Visual Studio didn't solve the problem and I still get the same error again.


Solution

  • If you're using Visual Studio 2013 and an intrinsic LightSwitch database, you can use the server explorer management options to view and maintain the table data.

    In order to do this, you'll need to use the following settings when adding the connection:

    • Data source: Microsoft SQL Server (SqlClient)
    • Server name: (localDb)\v11.0
    • Log on to the server: Use Windows Authentication
    • Connect to a database: Select the appropriate database name

    When selecting the database name, it should appear as the full project folder path followed by \BIN\DATA\APPLICATIONDATABASE.MDF.