CT050-3-1-WAPP Web Applications: Slide 1 Module Code & Module Title Slide Title
CT050-3-1-WAPP Web Applications: Slide 1 Module Code & Module Title Slide Title
WEB APPLICATIONS
ADO.NET
If you have mastered this topic, you should be able to use the following
terms correctly in your assignments and exams:
• SQL
• ADO.NET
• Programs connect to, and interact with, relational databases via an interface
software that facilitates communications between a database management
system and a program.
• A relational database stores data in tables. Tables are composed of rows and columns in
which values are stored.
• A primary key provides a unique value that cannot be duplicated in other rows of the
same table. The primary key uniquely identifies each row.
• Each row of a table represents a record.
• DBMS
– Microsoft SQL Server
– Microsoft Access
– MySQL
– PostgreSQL
– Oracle
– Sybase
– FrontBase
– Etc.
• The optional WHERE clause in a query specifies the selection criteria for the query. The
basic form of a query with selection criteria is
• The WHERE clause can contain operators <, >, <=, >=, =, <> and LIKE. Operator
LIKE is used for string pattern matching with wildcard characters % and -S.
– ( _ ) Pattern matching
SELECT FirstName, LastName FROM Members WHERE LastName LIKE ‘_I%’
• The result of a query can be sorted in ascending or descending order using the optional
ORDER BY clause.
• where ASC specifies ascending order, DESC specifies descending order and column
specifies the column on which the sort is based. The default sorting order is ascending,
so ASC is optional.
• Multiple columns can be used for ordering purposes with an ORDER BY clause of the
form
• The WHERE and ORDER BY clauses can be combined in one query. If used, ORDER
BY must be the last clause in the query.
• An INNER JOIN merges rows from two tables by testing for matching values in a
column that is common to the tables. The basic form for the INNER JOIN operator is:
• The ON clause specifies the columns from each table that are compared to determine
which rows are joined.
• If a SQL statement uses columns with the same name from multiple tables, the column
names must be fully qualified by prefixing them with their table names and a dot (.).
• An INSERT statement inserts a new row into a table. The basic form of this statement is
• SQL uses single quotes (') as the delimiter for strings. To specify a string containing a
single quote in SQL, the single quote must be escaped with another single quote.
• where TableName is the table in which to insert the row. The TableName is
followed by a comma separated list of column names in parentheses. The list of column
names is followed by the SQL keyword VALUES and a comma-separated list of values
in parentheses.
Module Code & Module Title Slide Title SLIDE 26
UPDATE Statement
• An UPDATE statement modifies data in a table. The basic form of an UPDATE statement is
where TableName is the table in which to update data. The TableName is followed by
keyword SET and a comma-separated list of column name/value pairs in the format
ColumnName = Value.
• The optional WHERE clause criteria determines which rows to update. If the WHERE
clause is omitted, the UPDATE applies to all rows of the table.
• A DELETE statement removes rows from a table. The simplest form for a DELETE
statement is
where TableName is the table from which to delete a row (or rows). The optional
WHERE criteria determines which rows to delete. If the WHERE clause is omitted, the
DELETE applies to all rows of the table.
• The ADO.NET object model provides an API Created for the .NET framework for
accessing database systems programmatically.
• A GridView ASP.NET data control displays data on a Web Form in a tabular format.
• A GridView's colors can be set using the Auto Format... link in the GridView Tasks
smart tag menu.
Object Description
Connection Establishes a connection to a specific data source. The base class for all
Connection objects is the DbConnection class.
Command Executes a command against a data source. Exposes Parameters and can
execute within the scope of a Transaction from a Connection. The base
class for all Command objects is the DbCommand class.
DataReader Reads a forward-only, read-only stream of data from a data source. The
base class for all DataReader objects is the DbDataReader class.
DataAdapter Populates a DataSet and resolves updates with the data source. The base
class for all DataAdapter objects is the DbDataAdapter class.
• ExecuteReader
• The technique through which GUI controls are tied to data sources is known as data
binding.
• SQL
• Insert
• Update
• Delete
• Select
• ADO.NET
Q&A
Module Code & Module Title Slide Title SLIDE 47
What we will cover next