Top Banner
CIS-266 Midterm Study Guide
34
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: CIS266 Midterm Review

CIS-266

MidtermStudy Guide

Page 2: CIS266 Midterm Review

Midterm

Open book, open notes True/False, Multiple Choice, Fill In,

Short Answer Bring a pen or pencil

Page 3: CIS266 Midterm Review

Class Library

Stores all classes and interfaces of the .NET language

Namespaces – sections within the library that contain classes, structures, enumerations, delegates, interfaces

Page 4: CIS266 Midterm Review

Class Library - Types

Refer to classes, structures, enumerations, delegates, interfaces, data types

Value types: each holds own value Reference types: points to location

Page 5: CIS266 Midterm Review

MDI

Projects can contain Multiple parent forms Multiple child form Independent forms (the splash

screen) When you close a parent form, all of

its children close A child cannot wander out of its

parent’s area

Page 6: CIS266 Midterm Review

The Window Menu

Create a Window menu for parent forms List open child windows Allow users to arrange child windows Window Layout Options this.LayoutMdi(MdiLayout.TileVertical) this.LayoutMdi(MdiLayout.TileHorizontal

) this.LayoutMdi(MdiLayout.Cascade)

Page 7: CIS266 Midterm Review

Context Menus

Also called shortcut or popup menus Use the regular menu designer to

create a menu Assign the top-level menu name to

the ContextMenu property of the form and/or controls on the form

Page 8: CIS266 Midterm Review

OOP Terminology-Abstraction A model of an object that determines

Characteristics -> properties Behaviors -> methods

Page 9: CIS266 Midterm Review

OOP Terminology-Encapsulation Combination of characteristics of an

object along with its behaviors ? one “package”

Data hiding Properties and procedures are hidden Programmer controls “exposure” of

properties and methods available to other objects

Page 10: CIS266 Midterm Review

OOP Terminology-Inheritance The ability to create a new class from

an existing class The existing (original) class is called

the base, superclass, or parent The inherited class is called the

derived, subclass, or child A derived class has an “is a”

relationship with its base class

Page 11: CIS266 Midterm Review

OOP Terminology-Inheritance Inheritance supports reusability Place common code in a base class Derived classes can call shared

functions

Page 12: CIS266 Midterm Review

OOP Terminology - Polymorphism

Methods with identical names have different implementations

The Select method is different for radio buttons, check boxes, and list boxes

Allows a single class to have more than one method with different argument lists

Page 13: CIS266 Midterm Review

Multitier Applications

Three-tier applications are popular Presentation tier Business tier Data tier

Goal is to write components that can be replaced without replacing other components

“Plug-in” new components

Page 14: CIS266 Midterm Review

Throwing and Catching Exceptions

The system throws an exception when a run-time error occurs

Your program can catch the exception and take an action

Use the Try/Catch block to enclose code that could cause an exception

OR Ignore the exception

Page 15: CIS266 Midterm Review

What Exception to Throw?

Use existing .NET Framework exception classes

Create your own exception that inherits from existing exceptions

Use the System.ApplicationException class when you throw your own exceptions from application code

Page 16: CIS266 Midterm Review

Variables

Instance variables (properties) are values associated with each new instance of an object

Use static (shared) variables (properties) for data common to class

Page 17: CIS266 Midterm Review

Creating an Enumeration

An enum is a list of named constants The data type of the constants must

be integer (short, long, byte)

Page 18: CIS266 Midterm Review

Collections

Container for a group of like items Need to be able to Add, Remove Include an Item Property to return an

individual member Typically the default property

Page 19: CIS266 Midterm Review

ADO.NET

Microsoft’s latest database object model

Allows .Net programmers to use a standard set of objects to refer to data from any source

Uses disconnected datasets with common data representation (data types) from multiple sources

Page 20: CIS266 Midterm Review

ADO.NET Providers

Data Providers manipulate the data using SQL statements or stored procedures

SQLClient for SQL Server OracleClient for Oracle databases OleDbClient for all other database

formats An ODBC provider is available for

older apps

Page 21: CIS266 Midterm Review

Data Provider Objects

Connection object – link to a data source

Command object – stores and executes SQL statements

DataAdapter object – handles retrieving and updating data in a DataSet object Includes commands and connection

TableAdapter expands the capabilities of a DataAdapter

Page 22: CIS266 Midterm Review

ADO.NET Components

DataSet Object holds a copy of the data in memory

Dataset object can be populated with data from many sources

Regardless of the data source, code handles DataSet objects the same

Dataset objects hold one or more DataTable objects and DataRelation objects

Page 23: CIS266 Midterm Review

Use the DataSet object

To transfer data between tiers To manipulate the data without an

open connection To relate data from multiple sources To bind data to a Windows form

Page 24: CIS266 Midterm Review

XML Schema File

Describes the fields, data types, and constraints

View dataset schema in the .xsd file found in the Solution Explorer

Page 25: CIS266 Midterm Review

Connection String

Stored in app.config (XML file) Connection string with a local

database specifies a |DATA| directory Database file is copied from project

folder to bin folder when run project

Page 26: CIS266 Midterm Review

Form Contents

Dataset manages data in memory Table adapter manages the requests

for data (both in/out of db) Can include multiple SELECT

statements Table adapter manager controls how

to manage data changes to table and related tables In relational database order of edits

matters

Page 27: CIS266 Midterm Review

Form Contents - 2

Data grid view provides on screen display of data

Includes built in tools – sorting, adjusting table

Binding navigator manages navigation of rows/editing

Binding source connects form/controls to data set Serves as “glue” to make sure the contents of

each field in each row properly displayed in controls

Page 28: CIS266 Midterm Review

Binding

Complex data binding happens when dealing with rows and columns (grid, list controls)

Simple data binding is for a control connected to a single column

Page 29: CIS266 Midterm Review

Reading/Writing Data

Getting data: Table adapter (or data adapter) has a FILL method that executes the SELECT statement

An argument specifies where the data should end up in memory

Saving data: Table adapter (or data adapter) has an

UPDATE method Table adapter manager has an UPDATE ALL

that manages the execution of updates to related tables

Page 30: CIS266 Midterm Review

Reading/Writing Data - 2

Ensure that all validation is done (this.Validate)

Ensure that no editing is going on before use Update (bindingsource.EndEdit)

Referential integrity means order matters

Page 31: CIS266 Midterm Review

Exceptions

Have exception classes for each data provider (SQL Server, Oracle, OLEDB, ODBC)

Reading the Number property of SQL Server exception objects refers to the specific error from SQL Server

Typical exceptions in ADO.Net not provider based DB Concurrency - row in table is different that the

original version (optimistic concurrency) Data Exception - generic exception from provider Constraint Exception violates validation rules No null allowed - required field is missing a value

Page 32: CIS266 Midterm Review

Data Grid Exceptions

Data grid can generate exceptions Value in cell doesn't match

requirements in data column (Null, invalid type)

Can find the location of an exception by Row and Column (index values)

Page 33: CIS266 Midterm Review

Refreshing Data

After save data, may want to "refresh" the dataset - make sure what's in memory is same as what was saved, especially when have identity columns

Page 34: CIS266 Midterm Review

Populating Combo Boxes with Data Set the DataSource property Connects to the dataset Set the DisplayMember property Connects to the field name Use the ValueMember if want to refer

to a different field than the one displayed

The SelectedValue specifies the field that receives the selection