How to Connect External Data Source With LightSwitch Beta 2 - Part I



Prologue:

In this article, we shall see how to connect LightSwitch Beta 2 with an external data source.

Types of Data Sources:

LightSwitch allows the user to connect with any of 3 types of external data sources.

  • Database
  • WCF RIA Services
  • SharePoint

In these three types of Data Sources first let us see about databases as external data sources as Part I.

Preparing the Solution:

Fire up the Visual Studio 2010; select the LightSwitch from Installed Project Template.

LightSwitch1.gif

Give the Project name as ExternalDSWithLS and click OK to start the application development.

Adding External Data Source:

Now we will see how to add an external data source for our LightSwitch application.

LightSwitch2.gif

After preparing the solution, you will see the folder like the icon with the name "Data Source".

Right click on the Data Source then select Add Data Source. It will display a wizard as shown below.

Selecting Data Source Type:

The wizard with those three types of Data Sources mentioned above will be displayed after selecting the Add Data Source option.

LightSwitch3.gif

In this wizard, select the Database Icon which is marked with an eclipse and continue by pressing the Next button.

Selecting Database Server & Database:

Before selecting Database server, a dialog box will pop up for selecting the Data Source. In that select Microsoft SQL Server and then Continue.

LightSwitch4.gif

In this Connection properties window you have to specify the database server name and the database name.

If there is no network server for the SQL, then we can use localhost in the Server name [No: 1].

And then select the database from the database list [No: 2]

At last you have to choose the table from the database which you have selected as in the figure below.

LightSwitch5.gif

Then you will be getting the table structure in the screen as in the picture shown below.

LightSwitch6.gif

Now you are at the final step. Press F5.

You will get the output screen as:

LightSwitch7.gif

Summary:

In this Part, we have seen the basic things to add an external data source to a LightSwitch application.

Thanks for spending your precious time here. Please provide your valuable feedbacks and comments, which make me to give a better article next time.

Please Rate this Article.


Thanks.

Up Next
    Ebook Download
    View all
    Learn
    View all