Various Ways of Attaching to External Data Source in LightSwitch 2012

In this article I am going to describes different ways how to attach to External Data Source in LightSwitch using Visual Studio 2012.

Here we will learn about various ways to attach to an External Data Source in LightSwitch using Visual Studio 2012.

This article describes various ways
to attach to an External Data Source.

Step 1

Adding External Data Source

In LightSwitch we can add an External Data Source in various ways.

One way is when we open an application in LightSwitch, in the middle of the screen "Attach to External Data Source" will be present.

start with data.jpg

Another way is to go to the the Solution Explorer, right-click on the data source and choose "Add Data Source".

Add Data Source.jpg

The third way is, after adding a table in LightSwitch, go to the menu bar and choose "Attach to External DataSource".

attach external.jpg

Step 2

Choosing Data Source Type

Lets you connect to a database and choose the database object.

database.jpg

Selecting the Data Source

The Connection Properties window will appear. In the Connection Properties window specify the server name and database name.

connection properties.jpg

To test the connection click on the "Test Connection" button. A pop-up window will appear and click the "OK" button.

test connection succeed.jpg

At last choose the table from the database and click on the "Finish" button.

table.jpg

Step 3

The table appears in the table designer window.

data.jpg

Step 4

Now go to the Solution Explorer and right-click on Screens and choose "Add Screen".

Add Src.jpg

The "Add New Screen" dialog box appears.
 Select the "Editable Grid Screen" from the Screen Template, under screen information, choose "RecordsData.Information" under screen data and provide a name to the Screen and click the "OK" button.

ADD NEW SRC.jpg

Press "F5" to run the application.

output.jpg