0% found this document useful (0 votes)
41 views12 pages

Introduction To Windows Programming: C# Review Sumarry

This document provides an overview of several key topics in C# and .NET programming: 1. It discusses the differences between Windows and console applications, and introduces the concept of events and event handlers which Windows applications use. 2. Several common controls for building graphical user interfaces are described, including forms, menus, buttons, and text boxes. 3. Database concepts like tables, rows, columns, primary keys and SQL queries are covered. 4. The document outlines how .NET applications can connect to and interact with databases using components like table adapters, datasets, and data-bound controls. 5. Controls for displaying and interacting with database data like list boxes, combo boxes, check

Uploaded by

Salahudin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views12 pages

Introduction To Windows Programming: C# Review Sumarry

This document provides an overview of several key topics in C# and .NET programming: 1. It discusses the differences between Windows and console applications, and introduces the concept of events and event handlers which Windows applications use. 2. Several common controls for building graphical user interfaces are described, including forms, menus, buttons, and text boxes. 3. Database concepts like tables, rows, columns, primary keys and SQL queries are covered. 4. The document outlines how .NET applications can connect to and interact with databases using components like table adapters, datasets, and data-bound controls. 5. Controls for displaying and interacting with database data like list boxes, combo boxes, check

Uploaded by

Salahudin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

C# REVIEW SUMARRY

Chapter 8: Introduction To Windows Programming


1- Differentiate Windows Application and Console Application
➢ Console applications: Each line in Main( ) executed
sequentially – then the program halts
➢ Windows applications: Once launched, sits and waits for
an event
2- Event: notification from operating system that an action,
such as the user clicking the mouse or pressing a key, has
occurred
3- Event-handler: methods for Windows apps
4- Interface: front end of a program
5- Graphical user interface (GUI) includes:
➢ Menus
➢ Text in many different colors and sizes
➢ Other controls (pictures, buttons, etc.)
6- Class heading definition: includes not only the class name,
but a colon followed by another class name.
➢ Derived class (first class)
➢ Base class (second class)
➢ public class Form1 : Form
7- Derived classes: inherit from base class.
8- Text: a property for setting/getting title bar caption which
can be used in constructor
9- Elements of a good design:
1- Appearance matters
- Human-computer interaction (HCI) research
2- Design considerations
- Consistency
- Alignment
- Avoid Clutter
- Color
- Target Audience.
Prepared By: Mohamed Faqi Abdulle, Mohamed Ali Ahmed & Ilyas Abdi Ahmed
C# REVIEW SUMARRY

10- Top-level window for an application is called a Form.


11- Properties
➢ Getters
➢ Setters
12- Controls as objects
➢ Buttons
➢ Labels
➢ Text-Box
Chapter 9: Programming Based On Events
1- List-Box Control: Displays list of items for single or multiple
selections.
2- To retrieve string data from List-Box use Text property
3- List-Box Selection Mode Property Values
➢ Multi Simple: use the spacebar and click the mouse.
➢ Multi Extended: use Ctrl key, Shift key, and arrow keys
➢ One
➢ None
4- Adding items to a List-Box at run time: use Add( ) method
with the Items property. For Example:
lstBoxEvents.Items.Add("string value to add");
private void btnNew_Click(object sender, System.EventArgs e)
{
lstBoxEvents.Items.Add(txtBoxNewAct.Text);
}
5- List-Box Control Properties
➢ Items: Get the values (Items) in the list Box
➢ Multi-Column: Gets or sets a value indicating whether
list-box supports multiple columns
➢ Selected Index: Gets or sets the zero-based index of
currently selected item.

Prepared By: Mohamed Faqi Abdulle, Mohamed Ali Ahmed & Ilyas Abdi Ahmed
C# REVIEW SUMARRY

➢ Selected Indices: Gets a collection that containing the


zero-based indexes of all currently selected items.
➢ Selected Item: Gets or sets the selected item
➢ Selected Items: Gets a collection containing currently
selected items.
➢ Selection Mode: Gets or sets the method in which items
are selected
➢ Sorted: Gets or sets a value for indicating whether items
are sorted alphabetically.
➢ Text: Gets or searches for the text of the currently
selected items
6- List-Box Control Methods:
➢ ClearSelected()
➢ Enter()
➢ FindString()
➢ FindStringExact()
➢ GetFocus()
➢ KeyPress()
➢ Leave()
➢ MouseEnter()
➢ MouseHover()
➢ MouseLeave()
➢ SetSelected()
➢ SelectedIndexChanged()
7- Combo-Box only allows a single selection to be made
8- Selected-Indices is a collection of indexes
9- Check-Box: appear as small boxes, Allow users to make a
yes/no or true/false selection.
10- Default Value of Check-Box: False Value.
11- Radio-Button: Appear as small circles, Give users a
choice between two or more options.
12- Radio-Button only allows One Selection.
Prepared By: Mohamed Faqi Abdulle, Mohamed Ali Ahmed & Ilyas Abdi Ahmed
C# REVIEW SUMARRY

13- Tab-Control: displays multiple tabs, like dividers in a


notebook, Each separate tab can be clicked to display other
options.
Chapter ## ADO.NET - C# Database Connections
1- Connection: To work with the data in a database.
2- The connection to a database normally consists of the
following parameters:
➢ Database name or Data Source: The first important
parameter is the database name to which the connection
needs to be established. Each connection can only work
with one database at a time.
➢ Credentials: The next important aspect is the username
and password which needs to be used to establish a
connection to the database. Credentials ensures that
the username and password have the necessary
privileges to connect to the database.
➢ Optional parameters: For each database type, you can
specify optional parameters to provide more
information on how .net should handle the connection
to the database. If no operation is performed for a
specific period of time, then the parameter would
determine if the connection has to be closed.
3- SqlCommand in C#: allow the user to query and send the
commands to the database.
4- ExecuteReader: method for results of query
5- ExecuteNonQuery: for insert, Update, and delete commands.
It is the method that is best for the different commands.
6- SQLCommand: is a class defined within C#. This class is used
to perform operations of reading and writing into the
database.

Prepared By: Mohamed Faqi Abdulle, Mohamed Ali Ahmed & Ilyas Abdi Ahmed
C# REVIEW SUMARRY

7- DataReader object: is used to get all the data specified by the


SQL query.
Chapter 11: Databases
1- Database Management System - DBMS: is software that
manages large collections of data.
2- C# Application can interact with a DBMS through a 3-layer
manipulation
➢ Application: interacts with the user and sends
instructions to D B M S
➢ DBMS: works directly with the data and sends the result
back to the application
➢ Data: the data stored in DBMS.
3- Data stored in a database are organized into tables, rows,
and columns
4- Table is a two-dimensional container made of rows and
columns.
5- Row is a complete set of information about a single item.
NB: Each row contains data about one person
6- Column holds an individual piece of information about the
item
7- When you create a database table you must specify a data
type for the column.
8- Most database tables have primary key. primary key is a
column that can be used to identify a specific row.
9- The column that is designated as the primary key must hold
a unique value for each row.
10- .NET application uses several components, arranged in
layers, to connect to a database
➢ Data Source: a source of data with which the
application can work

Prepared By: Mohamed Faqi Abdulle, Mohamed Ali Ahmed & Ilyas Abdi Ahmed
C# REVIEW SUMARRY

➢ Table Adapter: connects to a data source and


retrieves data from a table in a data source
➢ Dataset: gets a copy of a table from the table
adapter and keeps the copy of the table in memory
➢ Binding Source: a component that can connect user
interface controls directly to a dataset
11- Add New Item window provides a Service-based
Database option for creating an empty SQL Server database.
12- Default name of the SQL Server database is:
Database1.mdf
13- DataBase File Extenison is .mdf and the server will also
create a file that ends with the .ldf extension.
14- .ldf extension: This is a transaction log file used to keep
a log of all the operations that you perform on the database.
15- Data-bound control is a user interface control that is
connected to a data source.
16- DataGridView control is the simplest data-bound
control and can display a database table in a scrollable grid.
17- Details view is a set of individual controls that are
bound to the columns in a single row
18- Details view control is an alternative to the
DataGridView control for interacting with a database.
19- The SELECT statement allows you to select specific rows.
Select Column_Name From Table_Name
20- If you wish to retrieve every column in a table, use the
Star ( * ) character: Select * From Table_Name
21- When you need to narrow the list down to few selected
rows in the table, use the WHERE clause
Select Column_Name From Table_Name Where Criteria
22- Relational Operators for writing conditional expressions

Operator Meaning

Prepared By: Mohamed Faqi Abdulle, Mohamed Ali Ahmed & Ilyas Abdi Ahmed
C# REVIEW SUMARRY

> Greater than

< Less than

>= Greater than or equal to

<= Less than or equal to

= Equal to

<> Not equal to

23- SQL keywords and clauses are not case-sensitive but


string comparison are case-sensitive.
24- LIKE operator allows you to do a search based on a
pattern rather than specifying exactly what is desired.
25- The Underscore (_) wildcard character represents a
single character.
26- Using Logical Operators
➢ The AND operator requires both search criteria be
true for a row to be qualified as a match
➢ The OR operator requires that either of the search
criteria be true for a row to be qualified as a match
➢ The NOT operator disqualify a search Criteria.
27- To sort the results of a SELECT query, use the ORDER BY
clause

28- Table Adapter Query is SQL statement that is stored in a


table adapter and can be executed simply by calling a method

Prepared By: Mohamed Faqi Abdulle, Mohamed Ali Ahmed & Ilyas Abdi Ahmed
C# REVIEW SUMARRY

29- SQL Math Functions


➢ Avg(Column): calculates the average value in a
particular column
- Select Avg (Column_Name) From Table_Name
➢ Sum(Column): calculates the sum of a column’s
values
- Select Sum (Column_Name) From Table_Name
➢ Min(Column): finds the minimum value of a column.
- Select Min (Column_Name) From Table_Name
➢ Max(Column): finds the maximum value of a column
- Select Max (Column_Name) From Table_Name
➢ Count(Column): returns the number of values of the
specified column
- Select Count (Column_Name) From Table_Name
30- Query Parameters
➢ SQL queries can accept arguments
➢ Arguments are passed into parameter variables
➢ In SQL a parameter variable begins with the @
symbol.
Chapter 12: ADO.NET
1- ADO.NET is a set of classes used to communicate between an
application front end and a database to retrieve, manipulate,
and update data in databases.
2- ADO.NET does not provide a single set of classes that work
with all types of database management systems.
3- Two Main Components of ADO.NET for accessing and
manipulating data:
➢ .NET Framework Data Providers
➢ The DataSet

Prepared By: Mohamed Faqi Abdulle, Mohamed Ali Ahmed & Ilyas Abdi Ahmed
C# REVIEW SUMARRY

4- Data Provider is a set of classes that understands how to


communicate with a specific data source or database
management system.
5- The four data provider database sources currently included
with .NET

6- Each data provider includes a collection of classes used to


access a data source, such as a database.
7- The four core classes that make up each data provider

Prepared By: Mohamed Faqi Abdulle, Mohamed Ali Ahmed & Ilyas Abdi Ahmed
C# REVIEW SUMARRY

8- ADO.NET Name Spaces

Namespaces Description
It contains the common classes for
connecting, fetching data from database.
System.Data
Classes are like as DataTable, DataSet,
DataView etc.
Contains the classes that are used to
connect to a Microsoft SQL Server
System.Data.SqlClient
database such as SqlCommand,
SqlConnection, SqlDataAdapter.
Contains classes required to connect to
System.Data.Odbc most ODBC drivers. These classes include
OdbcCommand, OdbcConnection.
Contains classes such as
System.Data.OracleClient OracleConnection, OracleCommand
required to connect to an Oracle database.
It contains classes for connecting, fetching
data from any database(like msaccess, db2,
System.Data.OleDb oracle, sqlserver, mysql). Classes are like
as OleDbDataAdapter, OleDbDataReader
etc.

9- SQL Connection Object


➢ The Connection object provides a connection to the
database
➢ First Import: using System.Data.SqlClient; for SQL
Server

Prepared By: Mohamed Faqi Abdulle, Mohamed Ali Ahmed & Ilyas Abdi Ahmed
C# REVIEW SUMARRY

10- There are four Connection String Parameter Name:-


➢ Data Source: Identifies the server and it could be local
machine, machine domain name, or IP Address.
➢ Initial Catalog: Database name.
➢ Integrated Security: Set to SSPI or True to make
connection with user's Windows login.
➢ User ID : Name of user configured in SQL Server
Password: Password matching SQL Server User ID.
11- SQL Command Object provide three methods which are
used to execute commands on the database:
➢ ExecuteNonQuery: Executes commands that have no
return values such as INSERT, UPDATE or DELETE
➢ ExecuteScalar : Returns a single value from a database
query
➢ ExecuteReader: Returns a result set by way of a
DataReader object
12- The Command object enables access to database
commands to return data, modify data, run stored
procedures, and send or retrieve parameter information.
13- The DataAdapter serve as a bridge between a DataSet
and data source for retrieving and saving data.
14- We use Fill method to load data from the data source
into the DataSet and Update method to send changes made in
the DataSet back to the data source.
15- Limitations of Data Reader: there is not possible to sort,
filter, or manipulate the data while using a DataReader, since
it is read-only and forward-only.
16- Dataset is a cache of records retrieved from some data
source that may contain one or more tables from the data
source.

17- Difference Between Data Set and Data Reader


Prepared By: Mohamed Faqi Abdulle, Mohamed Ali Ahmed & Ilyas Abdi Ahmed
C# REVIEW SUMARRY

DataSet DataReader

DataSet object can


contain multiple rowsets DataReader provides
from the same data forward-only and read-
source as well as from only access to data.
the relationships between
them.

Dataset is a disconnected Datareader is connected


architecture. architecture.

Datareader can not


Dataset can persist data. persist data.

A DataSet is well suited


for data that needs to be It has live connection
retrieved from multiple while reading data
tables.
DatsSet is slower than Speed performance is
DataReader, Due to better in DataReader
overhead.

THE END!

Prepared By: Mohamed Faqi Abdulle, Mohamed Ali Ahmed & Ilyas Abdi Ahmed

You might also like