Where is the LightSwitch internal database?
Asked Answered
P

3

5

I've just downloaded VS LightSwitch and I'm doing a sample application for myself. I have created a new table by using Create new table option and have inserted some data. So after I inserted 3 records, the ID is obviously showing 3, which is correct.

Now I want to truncate the data from the table.

My question is, where is the internal table or the internal database (ApplicationData) ?

Thanks

Philipp answered 11/8, 2011 at 3:15 Comment(0)
S
6

The following steps worked for me:

  1. From the solution folder of your sample application, open the bin\data folder
  2. You should see the ApplicationDatabase.mdf file
  3. Open SQL Server Management Studio
  4. Use the attach functionality to open the mdf file
  5. After making your changes, detach it
Sievers answered 30/9, 2011 at 3:59 Comment(0)
P
2

It seems that LightSwitch uses SQL Server Express for its internal database. Try looking in the bin\data folder of your project for an ApplicationDatabase.mdf file.

Pearce answered 11/8, 2011 at 4:22 Comment(3)
That is true.. but while i am trying to open that, it is showing that the file is beng use by operating system.... so there is no way to truncate themPhilipp
More than likely because the file is attached as a user instance of SQL Server Express. You can try connecting to that instance from Sql Server Management StudioPearce
It may be that LightSwitch itself still has the file open. It attaches the file as a user instance (as Garett mentioned) each time you run your project. Try closing LightSwitch/Visual Studio before you try to use the database in SSMS.Germanism
S
0

From the official "Working with SQL Server LocalDB in LightSwitch Projects in Visual Studio 2012" (emphasis mine):

"When you create new tables, LightSwitch automatically creates them in the internal database, also known as the Intrinsic database or ApplicationData. In the first version of LightSwitch in Visual Studio 2010 we used SQL 2008 Express for the internal database development. Now with LightSwitch in Visual Studio 2012 we are using SQL Server LocalDB. (Note: LocalDB is only used during development time. When you deploy your app you can choose to deploy to any version of SQL Server.) LocalDB is the new version of SQL Server Express that has a much lower memory footprint and is targeted for developers. It is installed automatically when you install Visual Studio 11. "

Sciolism answered 28/4, 2014 at 21:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.