170 likes | 302 Views
Lesson 9. Working with your database. What are Code Builders?. Working with databases are a breeze with four code builders to work with your data. How Code Builders Work. Manipulating your database is basically the job of these four Code Builders Create a new ASP.NET file and call it Custom
E N D
Lesson 9 Working with your database
What are Code Builders? Working with databases are a breeze with four code builders to work with your data
How Code Builders Work • Manipulating your database is basically the job of these four Code Builders • Create a new ASP.NET file and call it Custom • Click on code • Click on Custom Controls in the Toolbox
SELECT Data Method • SELECT-creates a function that uses a SQL SELECT statement to access a database table and returns the data • Drag the SELECT Data Method on your work area Click the down arrow aside of Database: • Select the Movie Database and click OK
Construct a SELECT query Click the box where the * is Click Next This is what you have on your screen
Test Query Click on Test Query to view your database
Creating a method Type AllBond Click Finish
Back to Design • Click on Design Tab • Drag a DataGrid to the workspace
DataGrid Properties • Scroll down to the DataSource Properties for DataGrid1 • Type AllBond() which was the method that we just created
Page Properties Click the down arrow to the right of the DataGrid1 title and select Page
Page Properties • This is the last step to bind your database to DataGrid1 • Click on the lightning bolt which is Event
Load Double Click over the Load Property
Code to bind • Type DataGrid1.DataBind() • Press F5 to view • Congratulations! • Remember you could have only selected the fields that you wanted to show
Changing your view • Click on the Design Tab on your workspace • Click on your DataGrid1 • Scroll down and Select Classic1 and click OK • Press F5 to view
Custom Design your DataGrid • Click on DataGrid • Now click Property Builder located to the right of AutoFormat • Click on Format,DataGrid
More Changes • Change Forecolor to Navy • Change Back Color to Silver • Change Font Name to Aerial Black • Change Font size to Medium and click Bold • Click ok • Press F5 to view