Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Web-Enabled Decision Support Systems Database Connectivity with ADO.NET Prof. Name Position (123) 456-7890 University Name.

Similar presentations


Presentation on theme: "1 Web-Enabled Decision Support Systems Database Connectivity with ADO.NET Prof. Name Position (123) 456-7890 University Name."— Presentation transcript:

1 1 Web-Enabled Decision Support Systems Database Connectivity with ADO.NET Prof. Name name@email.com Position (123) 456-7890 University Name

2 2 Overview  14.1 Introduction  14.2 Database Applications Overview  14.3 Hands-On Tutorial: Creating a Simple Database Application  14.4 Auto-Created Objects in the Component Tray  14.5 Hands-On Tutorial: Displaying Data in Individual Windows Controls  14.6 Hands-On Tutorial: Binding Data to Existing Controls  14.7 Hands-On Tutorial: Displaying Related Data on a Windows Form  14.8 DataGridView Control  14.9 Hands-On Tutorial: Creating a Search Form  14.10 The Query Builder  14.11 Hands-On Tutorial: Creating a Look-up Table  14.12 Data Binding Properties of a ComboBox Control  14.13 In-Class Assignment  14.14 Summary

3 3 Introduction  A database application is a computer program that allow users to manipulate data in a DBMS through a user-friendly interface  Examples: –Amazon.com  Online shopping –Mapquest.com  Driving directions –University portals  Transcripts and tuition payment information

4 4 Overview  14.1 Introduction  14.2 Database Applications Overview  14.3 Hands-On Tutorial: Creating a Simple Database Application  14.4 Auto-Created Objects in the Component Tray  14.5 Hands-On Tutorial: Displaying Data in Individual Windows Controls  14.6 Hands-On Tutorial: Binding Data to Existing Controls  14.7 Hands-On Tutorial: Displaying Related Data on a Windows Form  14.8 DataGridView Control  14.9 Hands-On Tutorial: Creating a Search Form  14.10 The Query Builder  14.11 Hands-On Tutorial: Creating a Look-up Table  14.12 Data Binding Properties of a ComboBox Control  14.13 In-Class Assignment  14.14 Summary

5 5 Database Application Types  We classify database applications into the following three categories: –Display-oriented applications  Display data retrieved from a relational database on forms or web pages  Examples: Online newspapers, portal to view student transcript and grades, mapping websites –Transaction-oriented applications  Involve frequent transfer of data to and from a database  Examples: Online shopping, portal for university faculty to enter student grades –Communication-oriented applications  Communicate with other applications or processes  Examples: Application with underlying optimization software, Crystal Reports, Map Point

6 6 Database Application Overview  A VB.NET database application involves connectivity between a database and a graphical user interface (GUI)  Achieved through ActiveX Data Objects (ADO).NET –A collection of objects (classes) designed to support data access and manipulation –The ADO.NET architecture forms the basis of VB.NET database applications –ADO.NET object examples:  Connection object  TableAdapter object  DataSet object

7 7 Database Application Processes 1. Connecting to the database –Establish a two-way communication channel via Connection object 2. Fetching data using database queries –Bring data into an application in the desired format (filtered, sorted, etc.) via TableAdapter object 3. Temporarily storing the result somewhere –Via DataSet object 4. Displaying data on Windows forms –Data binding 5. Editing data in the application 6. Saving updated data back in the database

8 8 Database Application Data Cycle

9 9 Overview  14.1 Introduction  14.2 Database Applications Overview  14.3 Hands-On Tutorial: Creating a Simple Database Application  14.4 Auto-Created Objects in the Component Tray  14.5 Hands-On Tutorial: Displaying Data in Individual Windows Controls  14.6 Hands-On Tutorial: Binding Data to Existing Controls  14.7 Hands-On Tutorial: Displaying Related Data on a Windows Form  14.8 DataGridView Control  14.9 Hands-On Tutorial: Creating a Search Form  14.10 The Query Builder  14.11 Hands-On Tutorial: Creating a Look-up Table  14.12 Data Binding Properties of a ComboBox Control  14.13 In-Class Assignment  14.14 Summary

10 10 Create the Project  How-to: Create a Simple Database Application 1.In Visual Studio, choose the File | New Project option from the Main menu to open the New Project dialog box. 2.Make sure to select the Windows Application icon in the Templates area. 3.Name the project DatabaseConnectivity and click OK.

11 11 Create a Data Source 4.Choose the Data | Show Data Sources option from the Main menu. 5.In the Data Sources Window, click Add New Data Source to start the Data Source Configuration Wizard. Opening the Data Sources Window Invoking the Data Sources Configuration Wizard

12 12 Create a Data Source (cont.) 6.Select the Database icon on the Choose a Data Source Type page of the wizard. Click Next. Choosing a Data Source Type

13 13 Create a Data Source (cont.) 7.On the Choose Your Data Connection page, click New Connection to open the Choose Data Source dialog box. Specifying the Data Connection

14 14 Create a Data Source (cont.) 8.Select the Microsoft Access Database File in the Data Source list box. Click on Continue. 9.In the Add Connection dialog box that opens, select the University database file. Click Test Connection to verify the connection. Click OK. Creating the Database Connection

15 15 Create a Data Source (cont.) 10.Click Yes to copy the database to the current project folder. Click Next. 11.On the Save the Connection String to the Application Configuration File page, save the connection string with its default name. Click Next. Saving the Connection String

16 16 Create a Data Source (cont.) 12.Expand the Tables node on the Choose your Database Objects page, and select the student, department, transcript, and faculty tables. Click Finish. Selecting Database Tables for a Data Source

17 17 Using a DataGridView Control 13.In the Data Sources Window, drag the student table onto Form1 to create the DataGridView control along with a ToolStrip at the top of the form.  The ToolStrip provides controls for navigation, adding/deleting records, and saving data Drag-and-Drop to Create DataGridView Control Snapshot of the Component Tray

18 18 Test the Application 14.Press Ctrl + F5 to run the application. 15.Test the ToolStrip functionality by navigating through the student records. 16.Alter values in the DataGridView control, and click on the Save button in the ToolStrip to modify the data. Application Output

19 19 Property Window Review 17.Click the smart tag on the DataGridView control to view its Tasks list.  Note that the DataSource property is set to the TblStudentBindingSource.  Also note the automatic enabling of various options. Tasks List of a DataGridView Control

20 20 Code Review 18.Double click anywhere on the form to open the code behind window.  Review the auto-generated code that was created when we dragged the student table from the Data Sources Window. Form1_Load Event Populating the Student DataTable

21 21 Overview  14.1 Introduction  14.2 Database Applications Overview  14.3 Hands-On Tutorial: Creating a Simple Database Application  14.4 Auto-Created Objects in the Component Tray  14.5 Hands-On Tutorial: Displaying Data in Individual Windows Controls  14.6 Hands-On Tutorial: Binding Data to Existing Controls  14.7 Hands-On Tutorial: Displaying Related Data on a Windows Form  14.8 DataGridView Control  14.9 Hands-On Tutorial: Creating a Search Form  14.10 The Query Builder  14.11 Hands-On Tutorial: Creating a Look-up Table  14.12 Data Binding Properties of a ComboBox Control  14.13 In-Class Assignment  14.14 Summary

22 22 Auto-Created Objects in the Component Tray  Four objects were added to the Component tray when we dragged the student table node from the Data Sources Window onto Form1: 1.TableAdapter object  Host for SQL queries  Corresponding to each query, has a Fill method that executes a SQL query 2.DataSet object  Acts as an in-memory data repository  Can have any number of DataTables  DataTables are populated using a TableAdapter, by means of results of SQL queries

23 23 Auto-Created Objects in the Component Tray (cont.) 3.BindingSource object  Mediator between a Windows control and a DataSet 4.BindingNavigator object  Enables users to navigate through and manipulate data on Windows forms with the help of a ToolStrip control BindingSource Object Work Diagram

24 24 Overview  14.1 Introduction  14.2 Database Applications Overview  14.3 Hands-On Tutorial: Creating a Simple Database Application  14.4 Auto-Created Objects in the Component Tray  14.5 Hands-On Tutorial: Displaying Data in Individual Windows Controls  14.6 Hands-On Tutorial: Binding Data to Existing Controls  14.7 Hands-On Tutorial: Displaying Related Data on a Windows Form  14.8 DataGridView Control  14.9 Hands-On Tutorial: Creating a Search Form  14.10 The Query Builder  14.11 Hands-On Tutorial: Creating a Look-up Table  14.12 Data Binding Properties of a ComboBox Control  14.13 In-Class Assignment  14.14 Summary

25 25 Setting the Controls to be Created  How-to: Display Data in Individual Windows Controls 1.Add a new form, Form2, to the DatabaseConnectivity application. 2.In the Data Sources Window, select the student table node, and click the drop-down arrow to select the Details option. The default is the DataGridView control. Selecting the Details Option for a Table Display

26 26 Setting the Controls to be Created (cont.) 3.Expand the tblStudent node in the Data Sources Window. 4.Choose the controls for all the columns as shown below. Individual Displaying Controls for the Columns of the Student Table

27 27 Setting the Controls to be Created (cont.) 5.Drag the tblStudent node from the Data Sources Window onto Form2 to create individual data-bind controls for each selected column.  These controls are accompanied by appropriately titled Label controls. Individual Controls Shown in Form’s Design View

28 28 Test the Application 6.Set Form2 as the start-up form. Press Ctrl + F5 to run the application. The first record displayed is shown below. 7.Use the ToolStrip on top of the form to navigate through the records. Edit the value of any field, and click Save to test its functionality. Student Table Displayed One Record at a Time

29 29 Property Window Review 8.Select the TextBox control for the Name field, and navigate to its DataBindings property in the Property Window.  Note that the Text property of the Name TextBox is associated with the Name column from the TblStudentBindingSource. Data Binding Properties for the Name Column’s TextBox Control

30 30 Overview  14.1 Introduction  14.2 Database Applications Overview  14.3 Hands-On Tutorial: Creating a Simple Database Application  14.4 Auto-Created Objects in the Component Tray  14.5 Hands-On Tutorial: Displaying Data in Individual Windows Controls  14.6 Hands-On Tutorial: Binding Data to Existing Controls  14.7 Hands-On Tutorial: Displaying Related Data on a Windows Form  14.8 DataGridView Control  14.9 Hands-On Tutorial: Creating a Search Form  14.10 The Query Builder  14.11 Hands-On Tutorial: Creating a Look-up Table  14.12 Data Binding Properties of a ComboBox Control  14.13 In-Class Assignment  14.14 Summary

31 31 Adding a PictureBox Control  How-to: Bind Data to Existing Controls 1.Continue with the Windows form created in the previous hands-on tutorial. Drag-and-drop a PictureBox control onto the right of the existing controls. 2.Verify that the Image property of the PictureBox control has the default value None. Running Application with Data-bind PictureBox Control

32 32 Associating the Picture Column and Testing 3.Drag-and-drop the Picture column under the student table node from the Data Sources Window onto the PictureBox control. 4.Press Ctrl + F5 to run the application. Test the data binding for PictureBox by navigating through student records using the ToolStrip. Running Application with Data-bind PictureBox Control

33 33 Property Window Review 5.Re-open the Property Window for the PictureBox control and review its Image property.  It is now associated with the Picture column from the TblStudentBindingSource. Data-bind Image Property for the PictureBox Control

34 34 Overview  14.1 Introduction  14.2 Database Applications Overview  14.3 Hands-On Tutorial: Creating a Simple Database Application  14.4 Auto-Created Objects in the Component Tray  14.5 Hands-On Tutorial: Displaying Data in Individual Windows Controls  14.6 Hands-On Tutorial: Binding Data to Existing Controls  14.7 Hands-On Tutorial: Displaying Related Data on a Windows Form  14.8 DataGridView Control  14.9 Hands-On Tutorial: Creating a Search Form  14.10 The Query Builder  14.11 Hands-On Tutorial: Creating a Look-up Table  14.12 Data Binding Properties of a ComboBox Control  14.13 In-Class Assignment  14.14 Summary

35 35 Adding the Related Transcript Table  How-to: Display Related Data on a Windows Form 1.In the Data Sources Window, expand the student table node and select the transcript table node. Drag-and-drop it onto the bottom of Form2. Adding Related Tables from the Data Sources Window Component Tray

36 36 Editing the Transcript DataGridView 2.Select the transcript DataGridView and click its smart tag to view the Tasks list. Select the Edit Column option from the list to open the Edit Columns dialog box. Invoking DataGridView’s Edit Columns Dialog Box

37 37 Editing the Transcript DataGridView (cont.) 3.Select the StudentID column and click Remove to delete the column.  In general, we can use the Edit Columns dialog box to edit properties of existing columns, such as column heading, width, and more. Removing StudentID Column from the DataGridView Control

38 38 Editing the Transcript DataGridView (cont.) 4.Select the DataGridView and navigate to the Property Window. 5.Select the AlternatingRowsDefaultCellStyle property and click the Build button (…) to edit the alternating cell style. Styling Alternate Rows of a DataGridView Control

39 39 Editing the Transcript DataGridView (cont.) 6.Choose the BackColor and ForeColor properties in the CellStyle Builder dialog box as shown below. Setting BackColor and ForeColor Properties

40 40 Testing the Application 7.Press Ctrl + F5 to run the application. Test the parent-child relationship by navigating through student records using the ToolStrip. Running Application with Parent-Child Relationship

41 41 Property Window Review 8.Select the TblStudentBindingSource object (parent) from the Component tray and open the Property Window.  Note that the DataSource property of this object is set to the UniversityDataSet.  Also, the DataMember property is set to the tblStudent data table. DataSource Property of Parent BindingSource

42 42 Property Window Review (cont.) 9.Now select the TblTranscriptBindingSource object (child) from the Component tray and open the Property Window.  Note that the DataSource property of this object is set to the TblStudentBindingSource.  Also, the DataMember property is set to tblStudenttblTranscript, which is the name of the Data Relation object that relates parent and child tables. DataSource Property of Child BindingSource

43 43 Code Review  Since we added one more table on the form, Visual Studio added one more line of code. –Executes the appropriate SQL query to fill the tblTranscript data table. Form2_Load Event Populating the Transcript and Student Tables

44 44 Overview  14.1 Introduction  14.2 Database Applications Overview  14.3 Hands-On Tutorial: Creating a Simple Database Application  14.4 Auto-Created Objects in the Component Tray  14.5 Hands-On Tutorial: Displaying Data in Individual Windows Controls  14.6 Hands-On Tutorial: Binding Data to Existing Controls  14.7 Hands-On Tutorial: Displaying Related Data on a Windows Form  14.8 DataGridView Control  14.9 Hands-On Tutorial: Creating a Search Form  14.10 The Query Builder  14.11 Hands-On Tutorial: Creating a Look-up Table  14.12 Data Binding Properties of a ComboBox Control  14.13 In-Class Assignment  14.14 Summary

45 45 DataGridView Control  The DataGridView control is one of the most used data controls –We can use it to:  Display data  Format data  Sort data  Update and delete data  Select and navigate through data records  DataGridView Tasks: –We can use the smart tag to:  Access the DataSource property of the control  Add a new column to the column collection  Enable or disable edit, delete, and insertion operations

46 46 Sorting with DataGridView  DataGridView controls may be sorted by clicking any column heading in the grid –Click repeatedly to toggle sorting order (ascending/descending) –A small triangular icon appears in the column when sorted Sorting Data by DeptID Column in Descending Order

47 47 Data Binding  Binding data to the DataGridView control is intuitive and straightforward –Specify data source by setting the DataSource property to a BindingSource –Set DataMember property for specific tables/queries DataSource and DataMember Properties of a DataGridView Control

48 48 DataGridView: In Depth  Additional properties: –BackColor, BackgroundColor, ColumnCount, Font, ForeColor, Name, ReadOnly, RowCount, Visible, Width

49 49 Overview  14.1 Introduction  14.2 Database Applications Overview  14.3 Hands-On Tutorial: Creating a Simple Database Application  14.4 Auto-Created Objects in the Component Tray  14.5 Hands-On Tutorial: Displaying Data in Individual Windows Controls  14.6 Hands-On Tutorial: Binding Data to Existing Controls  14.7 Hands-On Tutorial: Displaying Related Data on a Windows Form  14.8 DataGridView Control  14.9 Hands-On Tutorial: Creating a Search Form  14.10 The Query Builder  14.11 Hands-On Tutorial: Creating a Look-up Table  14.12 Data Binding Properties of a ComboBox Control  14.13 In-Class Assignment  14.14 Summary

50 50 Hands-On Tutorial: Creating a Search Form  Often we are not interested in viewing an entire table of data –Prefer to display only the data that satisfies some specified criteria –We can do this using search forms in a database application  A parameterized query takes in some criteria as parameters and retrieves records that satisfy the criteria –Improve the efficiency of database applications –Fetch only the portion of the data that interests us

51 51 Adding a Parameterized Query  How-to: Create a Search Form 1.Add a form, Form3, to the DatabaseConnectivity application. 2.Drag and drop tblStudent from the DataSources Window to the form. This creates a DataGridView control named TblStudentDataGridView. 3.Choose the Add Query option from the Tasks list of the DataGridView. Adding a Query to a TableAdapter Through DataGridView

52 52 Adding a Parameterized Query (cont.) 4.This opens the Search Criteria Builder dialog box. Name the new parameter query FillByDept. Enter the SQL query as shown below in the Query Text area to construct a parameterized query. Adding Queries in Search Criteria Builder Dialog Box

53 53 Adding a Parameterized Query (cont.) 5.Click the Query Builder button in the Search Criteria Builder dialog box. 6.Click the Execute Query button to test the query. Working with the Query Builder to Design SQL Queries

54 54 Adding a Parameterized Query (cont.) 7.A Query Parameters dialog box opens. Test the query with the example “CISE” for the DeptID parameter value and click OK. 8.Preview the results of the query in the Query Builder itself. Note that all the records that are displayed have CISE as the DeptID. Click OK. Assigning a Sample Value to a Query Parameter

55 55 Adding a Parameterized Query (cont.) 9.We have now added a parameterized query, FillByDept, to the TblStudentTableAdapter. This automatically creates the ToolStrip control for DeptID input at the top of Form3.  We can also see that a ToolStrip control has been added to the Component tray. A ToolStrip Control for a Parameterized Query

56 56 Preview Data for Newly Added Query 10.Use the DataGridView’s smart tag to view its Tasks list, and choose the Preview Data option to open a dialog box. 11.Choose the query FillByDept from the drop-down list as shown below. Selecting a Query in the Preview Data Dialog Box

57 57 Preview Data for Newly Added Query (cont.) 12.Provide the testing parameter for the query as “CISE” and click Preview. The dialog box resembles below. The Preview Data Dialog Box in Action

58 58 Testing the Application 13.Set Form3 as the start-up form of the application, and press Ctrl + F5 to run the application.  Test the search or filtering functionality by entering different DeptIDs in the FillByDept ToolStrip. Running Form3 with the Search Functionality

59 59 Code Review 14.Open the Code Window for Form3 by double-clicking on the form.  Note the Visual Studio auto-generated the Click event.  Executes the FillByDept query of the TblStudentTableAdapter and fills the tblStudent data table of the UniversityDataSet. Executing Parameterized SQL Statements

60 60 Overview  14.1 Introduction  14.2 Database Applications Overview  14.3 Hands-On Tutorial: Creating a Simple Database Application  14.4 Auto-Created Objects in the Component Tray  14.5 Hands-On Tutorial: Displaying Data in Individual Windows Controls  14.6 Hands-On Tutorial: Binding Data to Existing Controls  14.7 Hands-On Tutorial: Displaying Related Data on a Windows Form  14.8 DataGridView Control  14.9 Hands-On Tutorial: Creating a Search Form  14.10 The Query Builder  14.11 Hands-On Tutorial: Creating a Look-up Table  14.12 Data Binding Properties of a ComboBox Control  14.13 In-Class Assignment  14.14 Summary

61 61 The Query Builder  The Query Builder dialog box helps us build SQL queries –Divided into four horizontal segments (listed from top to bottom):  Table Pane: Displays and allows the addition or deletion of DataTables and their relationships  Design Grid: Specifies the sorting order, filter criteria, group by, and output value for the fields being displayed  SQL View: Displays the SQL statement as we build the query in the Design Grid  Preview: Displays a preview of the query output

62 62 Overview  14.1 Introduction  14.2 Database Applications Overview  14.3 Hands-On Tutorial: Creating a Simple Database Application  14.4 Auto-Created Objects in the Component Tray  14.5 Hands-On Tutorial: Displaying Data in Individual Windows Controls  14.6 Hands-On Tutorial: Binding Data to Existing Controls  14.7 Hands-On Tutorial: Displaying Related Data on a Windows Form  14.8 DataGridView Control  14.9 Hands-On Tutorial: Creating a Search Form  14.10 The Query Builder  14.11 Hands-On Tutorial: Creating a Look-up Table  14.12 Data Binding Properties of a ComboBox Control  14.13 In-Class Assignment  14.14 Summary

63 63 Linking the Department Table  How-to: Create a Look-up Table 1.Drag tblDepartment from the Data Sources Window directly onto the DeptID ComboBox control on Form2. 2.Note that the DataSource property of the DeptID ComboBox control is set to TblDepartmentBindingSource. Creating a Department Look-up Table Component Tray

64 64 Linking the Department Table (cont.) 3.Set the DisplayMember property of the DeptID ComboBox control to Name and verify that the ValueMemeber property is set to the DeptID column.  The new Component tray objects will query and bring the names of the departments as a list into the DeptID ComboBox control.

65 65 Testing the Application 4.Set Form2 as the start-up form, and press Ctrl + F5 to run the application. 5.Navigate through the student records.  Note that the ComboBox displays the department to which the student belongs.  Use the drop-down arrow on the ComboBox to see the list of all the departments. Running Application with a Look-up Table

66 66 Property Window Review 6.Open the tasks list for the DeptID ComboBox control.  Note the values for all properties of the control. Tasks for ComboBox with a Lookup Table

67 67 Property Window Review (cont.) 7.Open the Property Window for DeptID ComboBox control and locate its Data Binding section.  Note the SelectedValue property value. Property Window for DeptID ComboBox Control

68 68 Code Review  The auto generated code for the lookup table is very simple. –The only addition to the code is a call to the Fill method of TblDepartmentTableAdapter (lines 25-26). Form2_Load Event Showing Fill Method for Look-up Table

69 69 Overview  14.1 Introduction  14.2 Database Applications Overview  14.3 Hands-On Tutorial: Creating a Simple Database Application  14.4 Auto-Created Objects in the Component Tray  14.5 Hands-On Tutorial: Displaying Data in Individual Windows Controls  14.6 Hands-On Tutorial: Binding Data to Existing Controls  14.7 Hands-On Tutorial: Displaying Related Data on a Windows Form  14.8 DataGridView Control  14.9 Hands-On Tutorial: Creating a Search Form  14.10 The Query Builder  14.11 Hands-On Tutorial: Creating a Look-up Table  14.12 Data Binding Properties of a ComboBox Control  14.13 In-Class Assignment  14.14 Summary

70 70 Data Binding Properties of a ComboBox Control  There are four main data binding properties of a ComboBox:

71 71 Overview  14.1 Introduction  14.2 Database Applications Overview  14.3 Hands-On Tutorial: Creating a Simple Database Application  14.4 Auto-Created Objects in the Component Tray  14.5 Hands-On Tutorial: Displaying Data in Individual Windows Controls  14.6 Hands-On Tutorial: Binding Data to Existing Controls  14.7 Hands-On Tutorial: Displaying Related Data on a Windows Form  14.8 DataGridView Control  14.9 Hands-On Tutorial: Creating a Search Form  14.10 The Query Builder  14.11 Hands-On Tutorial: Creating a Look-up Table  14.12 Data Binding Properties of a ComboBox Control  14.13 In-Class Assignment  14.14 Summary

72 72 In-Class Assignment  Develop an application that displays the list of faculty from the University database –Display on both:  DataGridView control  Individual controls –Show a faculty picture in the PictureBox control –Add a look-up table for the DeptID in an individual control on the form –Add search functionality to the form to display only those faculty records for which:  Query: “The salary is greater than the user-entered salary value and the department is the department specified by the user.”  Hint: Add a parameter query to the TableAdapter with two parameters

73 73 Overview  14.1 Introduction  14.2 Database Applications Overview  14.3 Hands-On Tutorial: Creating a Simple Database Application  14.4 Auto-Created Objects in the Component Tray  14.5 Hands-On Tutorial: Displaying Data in Individual Windows Controls  14.6 Hands-On Tutorial: Binding Data to Existing Controls  14.7 Hands-On Tutorial: Displaying Related Data on a Windows Form  14.8 DataGridView Control  14.9 Hands-On Tutorial: Creating a Search Form  14.10 The Query Builder  14.11 Hands-On Tutorial: Creating a Look-up Table  14.12 Data Binding Properties of a ComboBox Control  14.13 In-Class Assignment  14.14 Summary

74 74 Summary  Database applications can be roughly divided into three types: –Display-oriented –Transaction-oriented –Communication-oriented  The database application development process can be summarized into the following steps: 1.Connect to the database using a Connection object 2.Fetch data using database queries in the TableAdapter object 3.Temporarily store the results in a DataSet object 4.Display data on a Windows form by binding Windows controls to a DataSet 5.Edit data in the application 6.Save data back in the database

75 75 Summary (cont.)  We walked through the process of building a simple database application displaying the student table fields on the DataGridView control. –We reviewed the auto-generated code and auto-set properties by Visual Studio.  We also showed how the same data and columns can be displayed in individual controls on a form. –We then extended this application to bind the PictureBox to the picture column of the student table.  We further enhanced the application by adding a related transcript table to the form. –Used to display the courses and grades for each student record as we navigate through them.

76 76 Summary (cont.)  We have added a search or filter function to the form. –Displays only those student records belonging to the department specified by us in the ToolStrip.  Finally, we have added a look-up table for the department field of the student table. –Allows us to list all the department names via a drop-down list.


Download ppt "1 Web-Enabled Decision Support Systems Database Connectivity with ADO.NET Prof. Name Position (123) 456-7890 University Name."

Similar presentations


Ads by Google