Connect LightSwitch application to an Existing Database


Introduction

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.

image3.gif

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

image1.gif

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

image2.gif

Step 4: Click Attach to external Data Source.

image4.gif

Step 5: Select Database->Next.

image5.gif

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

image6.gif

Step 7: Check Tables->Finish.

image7.gif

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.

image8.gif

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.

image9.gif

Summary

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.

Up Next
    Ebook Download
    View all
    Learn
    View all