This article shows to display and search records in a LightSwitch Application in Visual Studio 2012
1. Open Visual Studio and select "File" -> "New" -> "Project...".2. Select the option LightSwitch from the Templates option.And provide the project the name "LSApplication1" with a specified location. 3. Click on the "OK" button. A new screen displays to start the LightSwitch Application.4. Select the secon option, in other words "Attach to external Data Source", the screen will look as in the following:5. Here we will create a new connection with the SQL Server database. Enter the user credentials and select the database.6. Click on "Test Connection" to test the successful connection.7. Click on the "OK" button.Specify the name of the data source and select the Product table. Click on "Finish".8. The following image shows what the display will look like:9. Now, right-click on the screen to add a new screen for the display and search a record.10. Click on "Add Screen", it will display as the screen below and in this we have many templates to select from.11. We choose the last option, called "Search Data Screen" and it looks like:We provide screen information such as screen name, screen data etc. Click on the "OK" button.12. Create the design of the Data Grid by default with a row and column layout with selected columns as product_id, product_name and product_rate.13. Build the application by pressing F6 and run the application by pressing F5.14. To search the item, enter item in the right side box and display the results.15. To export the data into Excel click on the right arrow icon just before the search text box.And display the result as in the following:So without writing a single line of code the form is ready.Happy coding
Printing in C# Made Easy