Connect LightSwitch application to an Existing Database


As you know, Visual Studio LightSwitch is a Microsoft Technology. Which is used for quickly build business applications. In the Visual Studio LightSwitch, you can create tables and their corresponding screens. If you want don't create the tables in LightSwitch, then you can connect Lightswitch to an existing database, If there are exist a database. In this article I will tell you How to connect LightSwitch to an existing database.

Step by Step solution

Step 1: First of all there should be a database in the system, If there are not a database in the system then you can create database in sql server. Like there is Student table in School database in the SQL Server.


Step 2: Open Visual Studio LightSwitch->File->New->Project.


Step 3: Select LightSwitch Application in C# ->Write name of application->Ok.


Step 4: Click Attach to external Data Source.


Step 5: Select Database->Next.


Step 6: Write server name->Select database name->Ok.


Step 7: Check Tables->Finish.


Step 8: There will open a table in LightSwitch Application, which is already stored in your database. Now you can change the type of data.


Step 9: Now open the Solution Explorer. You will see that it actually created the Data Source named "SchoolData", and in that data source we have the table called "StudentTable". So there will create a table from existing database. Same as you can connect another tables in the LightSwitch application from the database.



As you know that how to create the tables in LightSwitch Application. If you want don't create the tales in the LightSwitch Application then you can connect LightSwitch Application to an existing database.

Similar Articles