Presentation is loading. Please wait.

Presentation is loading. Please wait.

Some Basic Database Terminology

Similar presentations


Presentation on theme: "Some Basic Database Terminology"— Presentation transcript:

1 Some Basic Database Terminology
A relational database is data represented as a set of tables. The tables can be viewed like a spreadsheet Records (rows) — data for one item or transaction Fields (columns) — represent different elements of data Key field is a field that uniquely identifies the record To use database files, the standard terminology of relational databases needs to be understood. A database file (with an .mdf or .mdb extension) can hold multiple tables. Most tables use a key field (or combination of fields) to identify each record.

2 XML Data stored in XML is text, identified by tags — similar to HTML tags that can be edited by any text editor program. But the tags in XML are not predefined as they are in HTML. <course> <id>Comp 185</id> <name>Visual Basic .NET</name> <instructor>Rick Bournique</instructor> </course> The XML needed for accessing databases will be automatically generated in Visual Basic. ADO.NET can treat the XML data as objects, allowing the IntelliSense feature of the VS.NET environment to provide information to the programmer. *Can find specifications at World Wide Web Consortium (W3C)

3 Visual Basic and Databases
VB .NET uses ADO.NET for database access. ADO.NET is the next generation of Microsoft’s database technology,, ActiveX Data Objects (ADO). Using ADO.NET you can display data from a database on a windows form or a web form Using ADO.NET you can add controls to a form and bind data to them, e.g., a Label or TextBox Some special controls are designed just for data e.g., DataGrid or DataList An advantage of ADO.Net is that information is stored and transferred in Extensible Markup Language (XML). ADO.NET allows the access to database data in many formats including: OleDb, SQLClient for SQL Server (Microsoft’s proprietary DBMS), ODBC, and Oracle. Data from sources such as Access, Oracle, Sybase, or DB2 can be obtained when using OleDb.

4 Data Access in Visual Basic
You can drag tables and fields from the window onto a form to automatically create controls that are bound to the data. E.g., Data can also be displayed in individual fields, referred to as details. You can drag a field from the Data Sources window and drop it on an existing control — causes data binding to be set up automatically. the DataGridView control is bound to a table in a dataset. The data fields display automatically in the cells of the grid. To set up data access in VB, several classes and objects are used.

5 Steps to Display Data in Controls on a Form
Binding Source objects are automatically creates with a wizard. Table Adapters transfer data back and forth via XML. Datasets are disconnected in ADO.NET; the copy of data kept in memory is temporary and does not keep an active connection to the data source.. To display database data in bound controls on a form, a binding source, a table adapter, and a dataset are needed.

6 The Database Schema File
When a new data source is added to a project, a file .xsd is added to the Solution Explorer — the XML schema definition. The schema shows the names of the table(s) and fields, the primary keys for each table, and the relationships among the tables. Binding Source, Table Adapter, and Data Set objects are added to the form’s component tray.

7 Binding Individual Data Fields
Controls that are connected to fields are bound controls or data-bound controls. Easiest way to create bound controls is to use the automatic binding feature of the Data Source window. Automatic binding creates individual text box controls for each field of data and navigation controls allowing the user to more from one record to another. As the user clicks the navigation buttons, all controls change to display the data for the next record. *The next slide displays a form with data0bound text boxes.

8 Example 1 Let’s proceed step by step through the text example to create the R’nR Books Details View VB application. *The next slide displays a form with data0bound text boxes.

9 Example 2 Let’s modify the previous example in a couple of ways to demonstrate other concepts: Rather than using navigation controls, change the project to use a combo box for the ISBN field (the key). We will fill the ComboBox control with values from the database . The corresponding data elements fill the remaining fields. Rather than using the entire Books table, change the project to use only a few fields from the table. *The next slide displays a form with data0bound text boxes.

10 LINQ Language Integrated Query (LINQ), is a general purpose query language that can ask a question of any data that is defined as an object (e.g., a collection from a listbox), a database, or as XML. VB contains a LINQ to SQL component to convert database items to objects and a LINQ to XML component for converting XML document collections to objects. The general form is: Dim Variable = From Item In Object Where SelectionCriteria Select Subitems


Download ppt "Some Basic Database Terminology"

Similar presentations


Ads by Google