Introduction
In this article we are explaining how to connect to a SQL Server database in LightSwitch for Visual Studio 2012. A Visual Studio 2012 LightSwitch application allows you to connect to any type of data source.
The following data sources can be connected to in Visual Studio 2012 LightSwitch applications:
- SQL Server Databse.
- Share Point List.
- OData Service.
- WCF RIYA services.
How to connect a LightSwitch application to a SQL Server database
Step 1
Open Visual Studio 2012 and create a new "LightSwict application".
Step 2
Go to Solution Explorer and right-click on "Data sources" and select "Add Data source".
Step 3
A new window will be shown. Select "Database" and click "Next".
Step 4
In the Connection Properties dialog box, make sure that Microsoft SQL Server (SqlClient) appears as selected in the Data Source box and select your database name from the dropdown menu and click on "OK".
Step 5
A new window will be shown. Select the table name that you want to add and click on "Finish".
Step 6
After doing all that you will see the table structure in your application.
Step 7
Now run the application.