Display and Search Record in LightSwitch Application

1. Open Visual Studio and select "File" -> "New" -> "Project...".

1.png

2. Select the option LightSwitch from the Templates option.

2.png

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.

3.png

4. Select the secon option, in other words "Attach to external Data Source", the screen will look as in the following:

4.png

5. Here we will create a new connection with the SQL Server database. Enter the user credentials and select the database.

5.png

6. Click on "Test Connection" to test the successful connection.

6.png

7. Click on the "OK" button.

7.png

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:

8.png

9. Now, right-click on the screen to add a new screen for the display and search a record.

9.png

10. Click on "Add Screen", it will display as the screen below and in this we have many templates to select from.

10.png

11. We choose the last option, called "Search Data Screen" and it looks like:

11.png

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.

12.png

13. Build the application by pressing F6 and run the application by pressing F5.

13.jpg

14. To search the item, enter item in the right side box and display the results.

15.jpg

15. To export the data into Excel click on the right arrow icon just before the search text box.

14.jpg

And display the result as in the following:

16.png

So without writing a single line of code the form is ready.

Happy coding


Similar Articles