Vous êtes sur la page 1sur 712

ADO.

NET





//

:
: msvbnet@hotmail.com
: http://mhmdhmdy.blogspot.com
:( ) http://www.youtube.com/user/mhmdhmdy
: https://www.facebook.com/Poet.Mhmd.Hmdy
: http://mhmdhmdy.blogspot.com/2010/09/blog-post_9555.html
: https://www.facebook.com/vbandcsharp
:
: -
http://www.kutub.info/library/author/%%
:" " : -
http://mhmdhmdy.blogspot.com/2013/11/blog-post_29.html
:( ) -
http://www.mediafire.com/?n1qte7j9hdv1l98
:( ) -
http://www.mediafire.com/download/gzivkgedtvx2e4j/Pain_Cup.pdf

: " -
http://www.mediafire.com/?hd1jy6ca4ay3m9w
:"( " )-
http://mhmdhmdy.blogspot.com.eg/2015/11/blog-post_39.html

:
. :
.
. : .
. : .
. : .
. : .
. : .
. : .
. : .

. : .
. : .
. .
. .
. WPF .
. WPF .
:
http://mhmdhmdy.blogspot.com/2010/09/blog-post_9555.html

:
.Entity Framework Report Viewer .Crystal Reports .ASP.NET MVC . .WPF Windows Universal Applications
:
https://www.facebook.com/vbandcsharp

- Database Structure


Tables
Relational Databases
Relations
Constraints
Views
Indices

- Access
Access

Constraint
Database Compacting
Server Explorer
Access

- SQL Server
Management Studio Express






SQL Server
Indices
Constraints

- )Structured Query Language (SQL


Query Builder
Selection Queries
SELECT Statement
Aggregate functions
SQL Joins
Action Queries
DELETE
INSERT
UPDATE
UPDATE .WRITE
)Data Definition Language (DDL
Stored Procedures
Access
SQL User Defined SQL Functions
User-Defined Table Types

- ADO.NET
Server Client
ADO.NET
XML
Database Providers

- Connection Object
Connection String
DbConnectionStringBuilder Class
SqlConnectionStringBuilder Class
Settings
ConnectionStringsSection Class
ConnectionStringSettings Class
IDbConnection Interface
DbConnection Class

SqlConnection Class
SqlError Class
- Command Object
IDbCommand Interface
DbCommand Class
SqlCommand Class

SQL Injection
Parameters
DbParameterCollection
SqlParameterCollection Class
IDataParameter Interface
IDbDataParameter Interface
DbParameter Class
SqlParameter Class

- DataReader
IDataRecord Interface
DbDataRecord Class
IDataReader Interface
DbDataReader Class
SqlDataReader Class

- DataAdapter
IDataAdapter Interface
IDbDataAdapter Interface
DataAdapter Class
DbDataAdapter Class
SqlDataAdapter Class


Data Adapter Configuration Wizard
DbCommandBuilder Class
SqlCommandBuilder Class
ITableMappingCollection
DataTableMappingCollection Class
ITableMapping Interface
DataTableMapping Class
IColumnMappingCollection
DataColumnMappingCollection
IColumnMapping Interface
DataColumnMapping Class
-Provider Factories

DbProviderFactories Class
DbProviderFactory Class
N-Tiers
DbDataSourceEnumerator Class
SqlDataSourceEnumerator

-DataSet

DataSet Class
Generate DataSet Wezard
Custom DataSet

TableAdapter Class
TableAdapterManager
-

InternalDataCollectionBase Class

DataTableCollection Class
DataTable Class
DataRowCollection Class
DataRow Class
DataColumnCollection Class
DataColumn Class
DataTableReader Class
DataRelationCollection Class
DataRelation Class
ConstraintCollection Class
Constraint Class
UniqueConstraint Class
ForeignKeyConstraint Class
-Data Views

IBindingList Interface
ITypedList Interface
DataViewManager Class
DataViewSetting Class
IBindingListView Interface
ListSortDescription Class

DataView Class
IEditableObject Interface
INotifyPropertyChanged Interface
DataRowView Class
-Data Binding

IBindableComponent Interfac
BindingsCollection Class
ControlBindingsCollection Class
Binding Class
BindingMemberInfo Structure
BindingContext Class
BindingManagerBase Class
PropertyManager Class
CurrencyManager Class

Binding List Boxs
Data Source Configuration Wizard

ICurrencyManagerProvider Interface
ICancelAddNew Interface
IRaiseItemChangedEvents Interface
BindingList(Of T) Class
IListSource Interface
BindingSource Class
ListBindingHelper Class
BindingNavigator Class

- DataGridView
DataGridView Class




VirtualMode

Shared Rows
Paging



DataGridViewElement Class
DataGridViewBand Class
BaseCollection Class
DataGridViewColumnCollection
DataGridViewColumn Class
DataGridViewTextBoxColumn
DataGridViewButtonColumn Class
DataGridViewCheckBoxColumn Class
DataGridViewImageColumn Class
DataGridViewLinkColumn Class
DataGridViewComboBoxColumn
DataGridViewRowCollection
DataGridViewRow Class
DataGridViewCell Class
DataGridViewTextBoxCell Class
DataGridViewButtonCell Class
IDataGridViewEditingCell Interface
DataGridViewCheckBoxCell Class
DataGridViewImageCell Class
DataGridViewLinkCell Class

DataGridViewComboBoxCell Class
IDataGridViewEditingControl Interface
DataGridViewTextBoxEditingControl
DataGridViewComboBoxEditingControl
DataGridViewHeaderCell Class
DataGridViewColumnHeaderCell
DataGridViewTopLeftHeaderCell
DataGridViewRowHeaderCell
DataGridViewCellStyle Class
DataGridViewAdvancedBorderStyle
-DataGrid

IdataGridEditingService Interface
DataGridTableStyle Class

IDataGridColumnStyleEditingNotificationService Interface
DataGridColumnStyle
DataGridTextBoxColumn Class
DataGridBoolColumn Class
DataGridCell Structure
DataGrid Class
-Data Repeater

DataRepeater Class

DataRepeaterItem Class


Managed SQL Data Types

SqlBoolean Structure

SqlByte Structure
SqlDecimal Structure
SqlChars Class
SqlString Structure
SqlBinary Structure
SqlBytes Class
"SqlXml Class "XML

SqlFileStream Class
:


SQL Server Express

:

Desktop Web Site Network
..

.

Access SQL Server 2008
.SQL

ADO.NET

.

Binding
BindingNavigator BindingSource
DataGridView .DataRepater
***

:
DataReader
DataAdapter .TableAdapter
DataSet .Typed
. Binary Data .SQL Server 2008

Parameters Table-Valued Parameters


.Sql Server 2008
SQL Injection .
Sequentially .SQL Server 2008
.Access XML . XML Custom DataSet .
One-To-Many Relation Many-To-Many Relation
.Self Relation
Provider Factories

.N-Tier Applications
.Optimistic Concurrency
.
.
Virtual Mode .Paging
.DataRepeter
.Virtual Mode .
***



..






.
: .

:


:
Loops
.Functions
OOP Classes Interfaces .Inheritance
Collections Files .CultureInfo
TextBox CheckBox .Lists
"
"
..
LinQ To SQL
..


ADO.NET
Conceptual Model
.LinQ To SQL
:
.Structure
.Class
.Interface
.Constant
Property .
.Read Only Property
.Method
.Operator
.Event
Shared .


Database Structure

.

:
Database
..

..
" ":
)Database Management Systems (DBMS

..
Access SQL Server
Oracle MySQL
.


" "
) Structured Query Language (SQL
.
:
.Tables .Relations .Constraints .Views

:Tables

.. .

) (Books
) (Authors
) .(Publishers
:
. ) Columns Fields(:
..


Integers Long.
:
- .
-
:
.


.
. ) Rows Records(:

.. :

) (
:

ID

Name


Age

Class

..

:
-
..
.
- ..
Access

! ..

SQL Server Oracle
!
- ..



..
..Normalization
:
. :
ID
.Key
. :
.. :

) (..

.


..



!

:Relational Databases
Books

....

..


:
.
.
.
! !


... !

Normalization
Authors
Publeshers

.. :

..ID
AuthorID ..
) (
AuthorID :
"" " " " " " "
:
Author
ID

ID

Phone

Book


eMail

About

aktowfik@hotmail.com

msvbnet@hotmail.com

AuthorID

Pages

Price


PublisherID
.
:

-
.
- ..
) AuthorID
( ) Author (
" " ..
" "
.
- ..
" " " : "..
..


!
Relationship
)Author.ID
..(Books.AuthorID
) Publisher.ID .(Books.PublisherID
:
" " .Key field ID " " Primary Key Unique
) ( ..
.
AuthorID " " " " Foreign Key
..
) ( ..

) AuthorID
.(PublisherID
" " Master " " Details
..
.Master-Details

" " ..Join


.

:
:
- " " :One-to-many Relationship

" " One-to-many Relationship
.
- " " :Many-to-many Relationship
..
AuthorID
" " ..BooksAuthors
Link Table Junction table
: BookID AuthorID
:
AuthorID

BookID


..
.Many-to-many
- " " :One-to-one



..


.
" "
Unique
.
: Employees
:
Phone Employee ID
....

....

....

....

eMail
....
....
....
....

Address
....
....
....
....


EmployeesPasswords
Employees EmployeeID
:Unique
ID

Password
....
....
....
....

USerName
ash
mgdy
rshdan
ysrhwary

EmployeeID

ID EmployeeID

) .(ID
- :Self-Relation

..
Self-Relation
..
..Tree
..


-
.. :
ParentID Name ID

o
o

ID
ParentID ..
..:
ParentID
ID .. : = ID
ParentID ..
= ID
ParentID .
ID ParentID .. :
) (.





! .. :

ID

ID

ID

Grandparents
Name

Parents
GrandParentID
Name

Sons
Name

ParentID

:Constraints


..

Referential Integrity

.
..Constraints

: Foreign-Key Constraint
..
.

Unique Constraint
..

.One-to-one
:Views
..

.
: TopSales
.

Query
..
.

:Indices

) ( ..
..




Bytes ) int
(


! ..
!


Binary
Search .

! ..
..
!


..
:
!!
:Indexes
..

..



.. :

.

.
.
..


.

)
( ) (.
:


.
.. :
-
..
..
.
-

..

..

.. :
-

!

-


) (
.
-

: Loops




!


!! ..

.
:
.

.

Access

.. .

:Access
Access ..Microsoft Office
Access 2000 Access XP ..Access 2003
..Access 2007
Access XP
.
Access " " File " " ..New

.
" " New File
:

" " New " "


..Blank Database " " Save-File Dialog
..
" "Books.mdb
.
:

" "
Create Table in Design View ..
:


.. ..
:

Field Name
ID
Author
CountryID
Phone
About


Data Type
) (
AutoNumber
)( Text
)(
Number
)( Text
)(
Memo

Description



.
.

:


.
:
ID Context Menu " "
Primary Key ..
.. " "
Indexed " "
) Yes (No Duplicates
.
Author " " Field Size
.
CountryID " " Field Size ..Byte
..
Byte
..

..


..

.
Phone " " Field Size ..
.. :
-
:
+2 - 0102020375
+2 050 17354-036
..


..
.
-

) Long Integer (4 Bytes

!
-
0020102020375
20102020375
!
-
..
..
) ( ..
.
Ctrl+S ..
.. Authors .OK

Authors
.. ..

ID
.
:
. . .Tap . ..

.
Delete Delete .Context Menu
..
Books.mdb :
Authors .
Books
..

.
Classes .
Countries .
Publishers .
Sales


.

:

Referential Integration :

Tools " " ..Relationships


" " ..
Add
..
.
ID
AuthorID ..
.. ..
:

" " Enforce Referential Integrity


..
:
Cascade Update Related:Fields
) (
AuthorID
.

:
ID
..

..
!
:Cascade Delete Related Fields ) (
) ( .
" " Create ..
..
"" .Delete

:



" " Print

Relations File
:

" " Rrint Setup " "


Print File .
.. ..
" "+ .. )
( .. " "+ " "-
..
"."-

) (
AuthorID
.

:Constraint
) (
..
..Authors
" " ..Check Constraint
)(
!!
:
"" ><
..

.. .OK
) ( ..
..

! ..
.

..SQL

.

:Database Compacting

..
..
)
(
.

..
!

..



..
..

..
!

.

..
!!
"
" Database Compacting
.

Access Tools
" " "
" ..Compact and repair database Access
..
.
***
..Access

Visual Basic For
Applications VBA ..
Access !
Access .

:Server Explorer
Server Explorer
..
Server Explorer ..View
:
:Data Connections

..
.
:Servers

Database Servers ..

Local Server
.

:Access

Data Connections
" " ..Add Connection

" " Choose data source


:

..Microsoft Access Database File :


Data Provider
.. Access
:OLE DB
.Net Framework Data Provider for OLE DB
Continue "
" :Add Connection

..
Change
.

Database File Name Browse
.. Books.mdb
)
(.

..
: Admin
.
Test Connection ..
..
.

OK ..
Books.mdb

.
" "+ ..

.

Tables

.

.

SQL Server

Access ..
SQL Server

Network ..Internet
" "Server
Local Server Online
Server ..
Disconnected
..Connected
.
:
:SQL Server 2000 -

:
Microsoft SQL Server Desktop Engine
) (MSDE
Microsoft Office XP .MSDE2000
:SQL Server 2005 -

:

SQL Server Management Studio Express


SQL Server 2005


..

:

http://www.microsoft.com/downloads
.. :
SQL Server Management Studio
) ( ..
..
.
:SQL Server 2008 -

:

SQL Server 2008 Management Studio Express



.

:Management Studio Express



:
Microsoft SQL Server 2008 Express Edition

Add or Remove Features

.. :
Windows Installer 4.5
WS-Management v1.1
)Windows PowerShell V2 (CTP3
.NET Framework 3.5 SP1

.
:

SQL Server 2008 Management Studio Express


:

Install
..
..
.. OK
.. Select All
.
Desktop:
Start\Programs\Microsoft SQL Server 2008\SQL Server Management Studio

SSMS
:

:
- :Server Type
:
:Database Engine -
.ASP.NET
:SQL Server Compact Edition -
.
- :Server Name






<Browse for
> more


2 Tabs

) (
..Network Local
Server + Database Engine
..

(MyPC
..SQLEXPRESS OK
.. ..MYPC\SQLEXPRESS
MyPC
.. MohammadPC
...MohammadPC\SQLEXPRESS :.
- :Authentication
:

- :Windows Authentication


..

..
.
- :SQL Server Authentication

Username
Password
..


..


..
) (
.
OK
..
Object Explorer
Databases


.

Object Explorer
Databases Context Menu
New Database .


..
Database Name
.. Books
:
:Books.mdf -

Rows Data
..

..


.
:Books_log.ldf -
Log
..Log
%
..
.
Log


.. :
-
.
-
.
- .. Access


..
Log
..


..


.
Path :
C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA


.
:

Format
.
Add
..
Database Name ..
Remove .
..Owner
> <Default
Username ..

.. Browse
] [sa
System Administrator OK .

OK
.. Cancel

.OK

Books Databases
.. + ..
Tables
..
New Table ..

..
IDE
.

:


..
..Allow Nulls
Table1 Authors .
:

) (
!
SQL Server Management Studio
Tools Options Designers

Table and Database Designers

:
Prevent Saving Changes that require table re-creation.
.. Ok
.

..
..
Shift
..
Ctrl+C
Ctrl+V
..
.
Tables
dbo.Authors dbo
" " Database Owner
.. dbo
Schema ) dbo (
Guest Guest.Authors
..Guest


.Administrator
dbo.Authors ..
:
:Design .
:Select Top 1000 rows
..




Execute ..
.SQL Queries

:Edit Top 200 Rows



.
:Rename
..


.
:Delete
OK
..Cancel
Delete .
:Properties .

..
Books.mdf .

:

:

)(Bytes

bigint

int

smallint

tinyint
bit

)decimal(x, y

)numeric(x, y

money

smallmoney


^ ) - ^ (.

^ ) - ^ (.

^ ) - ^ .(
.

) Yes
(No ) True .(False

x
) ( y
.



.+

- .+


float
..

4 Bytes

.8 Bytes

real
float .

datetime
..:
''01/01/1998 12:59:59.999

// .//
datetime
)datetime2(n
// ..//
n
..

n .
..

smalldatetime
01/01/1998 12:30 :
:

date
01/01/1998
.. n
)time(n
.
) datetimeoffset(n
..:

01/01/1998 12:35:29.123 +2:15




.
n
.

)char(n

n
..

)varchar(n

Unicode

Server
..

.

Length


..




.
char


) n n
( ..





..

.


)varchar(MAX

- ^ ..
=
. +

Key
.Indexes
varchar
text


) - ^ ( ..
.Unicode
n n
)nchar(n
Unicode
2 Byte

..
.
+n
)nvarchar(n

Unicode
.. .


)nvarchar(MAX

- ^ ..

= . +

ntext
Unicode
) - ^ ( ..
.

)binary(n

+ n

)varbinary(n

+ n

Varbinary
)(MAX


n ..Bytes
= n

) Null
.(ASCII

..
n
.


- ^ ..
=
. +

image

)- ^

.(Bytes

sql_variant


) (
:
)text, ntext, timestamp, varchar(MAX

uniqueidentifier

xml
Timestamp

Udt
Structured

GUID

Hexadecimal .
XML
.

Bytes


.Version-Stamping
.User-Defined Type

Table-valued .

:
) )( (n
Byte
..
Text nText image

) (Max
..Byte
Sequential
.
n

:

+ Identity Specification
) (Is Identity Yes
.. " "
Identity Increment Identity Seed ..
Identity
Seed ..
Identity Increment .

..et Primary Key

.Remove Primary Key

:
Object Explorer
Books " " Database
Diagrams New Database
..Diagram
.. Add
Close ..


Set Primary Key
.


)
(


Table View ..Slandered



Keys

Name
Only

..Custom



Modify Custom

> .




..

Column Names .

..
:

OK :


..Access :
FK_T1_T2n FK " " Foreign Key T1
) ( T2
) ( n
..
)(Name
.. :
:Check existing data on creation or re-enabling ) Yes (

.
:Enforce for replication ) Yes (
.
:Enforce foreign key constraint ) Yes (

.. :
Referential
Integrity

..

.
:INSERTs and UPDATEs Specifications + :
:Delete Rule

.
:Update Rule

.
:
No

..

Action.
Cascade

.

.
Set Null
DBNull
.
Set

Default
.
OK .
:

..
.


" " " ".


..Properties
..


Delete Relationship From database
.Yes
:
Zoom Zoom

.
Add Text Annotation



.Set Text Annotation Font
.Show Relationship Labels

.View Page Breaks
Copy Diagram to Clipboard
Paint Word
.
Page Setup Print .File
Ctrl+S
.. Diagram1 ..
..

..Warn About Tables Affected Yes
.
..

.

:

..SQL Server Configuration Manager
:
\Start\Programs\Microsoft SQL Server 2008
Configuration Tools\ SQL Server Configuration Manager
SQL Server Services
:


) ..SQL Server (SQLExpress

Stop Start Restart ..

..
) (
..
.J

:

Object Explorer

Tasks Detach
..OK
..
OK.
Databases
Attach
Add
..
.. OK
.

:

..

IDE

..SQL Server Management Studio
Server Explorer
! Object Explorer

:
Server Explorer View
Data Connections
..Create New SQL Server Database
:


.. .MYPC\SQLEXPRESS
:

) (local " .. ".
Control Panel

.\SQLEXPRESS . MYPC\SQLEXPRESS
Use SQL
Server Authentication

..
.Use Windows NT Integrated Security

.. Test OK .
mypc\sqlexpress.Test.dbo .
Test.mdf :
\C:\Program Files\Microsoft SQL Server
MSSQL10.SQLEXPRESS\MSSQL\DATA

Test_log.LDF
.
:
Test Server Explorer
Delete


.. SSMS
DELETE
Tasks\Detach .
Test ..


! ..

" " Open Table Definition Design
Show
Select
Top
1000
Table rows :
Data
..! Edit Top 200 Rows
Show Table Data Result Pane
Query Builder
Pane
.


Dock ..

:


.Dock

:SQL Server
Books.mdf ..

Books.mdb :Access
Data Connections " "
.Add Connection
" " Choose data source Microsoft SQL Server Database File : .OK
- :


.

..
Select or enter a database file
..
Attach a database file




Browse
) (Books.mdf ..
Logical Name
..
.
Test ..
SQL Server Management Studio Detach
..
..
Restart
.
OK ..
.





:Indices
..
..
Authors.Author ..Books.Book
:
Authors

..Indexes/Keys
:


PK_Authors )(
ID .ASC
Add ..
..IX_Authors IX
Index

..
..
Name .IX_Authors_Author
..
..Columns
:


..

...
..

) Ascending (Desinding ..
..
Authors OK
.
.. :
Author Is
Unique ..Yes Unique Key
Type Unique Key ..Index.
Close
.. !
Book .

:Constraints
..Access
..
Authors Check
..Constrains
:

Expression ..
Access

Access ..
.. ) (
:
'' >< Author


OK
.

)(!
***


..
..SQL .





" )( ) ( "
" : "
" "


" "
..




//

.. ..
..

.:
- .. .

..
..
.


.
.

) Structured Query Language (SQL



) SQL " "
" "( ..
.
SQL Non-
procedural
.. SQL
.
:
SQL Server T-SQL SQL

Stored Procedures ..
T-SQL .
SQL :
- ):Data Manipulation Language (DML

..Queries
Selection Queries
.Action Queries
- ):Data Definition Language (DDL

.Constrains

:Query Builder

" " Query Builder SQL .Visual
Books
..
..Views .Views
Views
..Add New View " " Add Table
.. Authors
Books Add .Close
:4 Panes
- .Diagram Pane .Criteria Pane - .SQL Pane .Results Pane
.Pane

:Diagram Pane

..
.Database Diagrams
Delete
..
Add Table
.

..

.
ID
AuthorID
SQL ..
.
Inner Join
) .. (.
SQL ..
..

) ..(All Columns Author
Book .
:Criteria Pane


.

.. ) ( Output
.
" " Alias
..
Author
"" .. Book "".



.
Alias .
Criteria Pane
.
:SQL Pane
SQL
.. SQL

.SQL
SQL
..
) SQL (
SQL .
.. !

Run Query Ctrl+R
.
:Results Pane
..
.Clear Results

View
Authors_Books ..
Authors_Books Views

Design View ..
.
Authors_Books
Show Results ..
.

SQL ..
SQL Ctrl+R ..
SQL .
View
Views
" " New Query
.
.SQL

Selection Queries

..
:

:SELECT Statement
SELECT ..
:
SELECT
FROM
:
- SQL
Capital
select Select SELECT .
- " ..",:
SELECT Author, Book
FROM Authors, Books


! ..
.
-
) " ": " "+ "=" ... (
] [ ..
..:
]SELECT [Author], [Book
]FROM [Authors], [Books
-
) : . ( ..
..:
]SELECT [Authors].[Author], [Books].[Book
]FROM [Authors], [Books
:

-
-

-
-

SELECT Authors.Author, Books.Book


FROM Authors, Books

..SELECT Author
Book .
SQL
C++
";" ..
:
SELECT Author, Book FROM Authors, Books
.. .
SQL
.

..
! .. SQL "*"
) (ALL :
* SELECT
FROM Authors
:
SELECT All
FROM Authors
:
*SELECT Authors.*, Books.
FROM Authors, Books

..:
SELECT A.*, B.ID, B.Book
FROM Authors A, Books B
AS :
SELECT A.*, B.ID, B.Book
FROM Authors As A, Books As B

"" :WHERE Clause



.. WHERE

.

If .
:
SELECT Book
FROM Books
WHERE AuthorID = 1 OR AuthorID = 3

! ..
) ( ..
.. :
SELECT Book
FROM Books, Authors
' AND AuthorID = Authors.ID ' = WHERE Author
FROM
.WHERE
: ) (

..
) ( .

:
SELECT Book
FROM Books, Authors
' ' = WHERE AuthorID = Authors.ID AND Author
) (
) ( ..
:

SELECT Book, Author


FROM Books, Authors
)' ' = ' OR Author ' = WHERE (Author
AND AuthorID = Authors.ID


:
SELECT Book, Author
FROM Books, Authors
WHERE AuthorID = Authors.ID
:

) WHERE ( = :
* SELECT
FROM Books
WHERE 1 = 2


.

WHERE :

..Criteria Pane
ID .
..Filter
..
Filter ID:
=5
:
>5
....
OR
OR ..

..OR
ID )
(:
Or
= 20

Or
= 12

Filter
=7

Table
Authors

Column
ID

AND
..
Filter ID Author
.AND
..
AND
ID ..
Column
.Authors.ID
..ID Filter :
<> 8
Filter :
<> 9

OR
Filter ID:
=6
Filter Author OR
:
' ' =
:
Filter
AND OR ..OR
Or Filter
.OR

:

:WHERE


AND
OR
NOT

=
><
>
<
=>
=<

SELECT ID, Book


FROM Books
WHERE ID < 9
" "
:
SELECT ID, Book
FROM Books
' ' < WHERE Book

"" :BETWEEN Operator


..
:
SELECT Book, Price
FROM Books
WHERE Price BETWEEN 3 AND 10
NOT
..
:
SELECT Book, Price
FROM Books
WHERE Price NOT BETWEEN 3 AND 10

"" :IN Operator


BETWEEN
.. AND
.
IN
.. , :
SELECT ID, Book
FROM Books
)WHERE ID IN (2, 6, 7, 10
)
( :
SELECT ID, Book
FROM Books
)WHERE ID NOT IN (2, 6, 7, 10
)
( ) ( ) (:
SELECT Book, Author
FROM Books, Authors
WHERE AuthorID = Authors.ID
)' ' ' , ' ', '( AND Author IN

"" :LIKE Operator


WHERE

:

% ) (
.
:
:
SELECT Author
FROM Authors
'%WHERE Author LIKE '%

'.'%
_ .
:
:
SELECT Author
FROM Authors
'%__" WHERE Author LIKE
"_" )
( %

.
# .
] [ ..
:
][ACdF
:
][g-y
g .y
:
:
SELECT Author

FROM Authors
']%[__" WHERE Author LIKE

:
']%-['
] ^[ )
(..
: .
:
A B :C
SELECT Author
FROM Authors
'WHERE Author LIKE "__[^ABC]%

T Z S :
''[^T-Z]%S
:

.. ' '%50[%]%
" "50% .

:
WHERE
SELECT !
) ( )
(:
* SELECT
From Books
WHERE AuthorID = (SELECT ID
FROM Authors
' ' = WHERE Author
)' ' = OR Author
SELECT
SELECT
.AuthorID
:
*SELECT Books.
From Authors , Books
WHERE AuthorID = Authors.ID
' ' = ' OR Author ' = AND Author

:
WHERE
SUBSTRING LEFT RIGHT
TRIM ..LEN
"":
SELECT Publisher
FROM Publishers
)'' = )WHERE (RIGHT(Publisher, 2
:
)SELECT LEN(Publisher
FROM Publishers

:AS
AS ..:
SELECT A.*, B.ID, B.Book
FROM Authors As A, Books As B
AS ..:
][ ], Author AS [ SELECT Book AS
FROM Books, Authors
WHERE AuthorID = Authors.ID

.

..
.. Concatenate

AS:
] [ SELECT Book + '_' + Author AS
FROM Books, Authors
WHERE AuthorID = Authors.ID
:
Book + '_' +
Author Criteria Pane
" " ..
..
Column .

.

:TOP
SELECT

..
:
SELECT TOP 5 Book, Author
FROM Books, Authors
WHERE AuthorID = Authors.ID

PERCENT:
SELECT TOP 5 PERCENT Book, Author
FROM Books, Authors
WHERE AuthorID = Authors.ID

"" :DISTINCT
..

) ( .. :
SELECT DISTINCT Book
FROM Books

:Null Values
Null
.. ""
.
WHERE
NULL False ..
.

IS NULL ..IS NOT NULL
Author :
SELECT * FROM Authors
WHERE Author IS NULL

Null
Allow Nulls
.

:ORDER BY
..
:
SELECT Book, Author
FROM Books, Authors
ORDER BY Book
WHERE AuthorID = Authors.ID


:
SELECT Book, Author
FROM Books, Authors
ORDER BY Book, Author
WHERE AuthorID = Authors.ID
..
DESC
ASC )
( ..:
SELECT Book, Author
FROM Books, Authors
ORDER BY Book DESC, Author ASC
WHERE AuthorID = Authors.ID

:

Diagram Pane
Sort Ascending
Sort Descending ..
..
..
SQL
.

Criteria Pane
Sort Type .

Sort Order

.

:Aggregate functions
SQL .. :
) (
SELECT.
) ( .. ..
AS SQL
.
WHERE .
:

:COUNT
..
.. :
] [ SELECT COUNT(Book) AS
FROM Books, Authors
' ' = WHERE Author
AND AuthorID = Authors.ID
NULL
.. )*(
:
] [ SELECT COUNT(*) AS
From Authors
:COUNT_BIG
COUNT COUNT
int COUNT_BIG
bigint
!
:SUM
..
.
: :
] [ SELECT SUM(Copies_No) AS
From Books
:AVG
) (
.. ..
:
] [ SELECT AVG(Copies_No) AS
From Books
:MIN

..
.
:MAX
..
.
:CHECKSUM_AGG
T-SQL
..
Check Sum

..
..
..
..:
)SELECT CHECKSUM_AGG(Copies_No
FROM Books
T-SQL CHECKSUM
..
Hash Value
.
:VAR
Statistical Variance
..
!
:VARP
Statistical variance for population
.
:STDEV
Statistical Standard Deviation
.

:STDEVP



Statistical Standard Deviation for Population .

..WHERE

:
] [ SELECT COUNT(Book) AS
FROM Books, Authors
WHERE AuthorID = Authors.ID
)AND Author = (SELECT MIN(Author
)From Authors
SELECT MIN
..WHERE
INNER JOIN .


DISTINCT
.. ) (..

AuthorID :
] [ SELECT COUNT (DISTINCT AuthorID) AS
From Books
:

Criteria Pane Add
..Group By Group By
..Group By
..
.

:GROUP BY
..

.

GROUP BY

) (

..
:
] [ SELECT AuthorID, COUNT(AuthorID) AS
FROM Books
GROUP BY AuthorID
] [ ORDER BY
.SQL
..
.. Where :
] [ SELECT Author, COUNT(AuthorID) AS
FROM Authors, Books
Where AuthorID = Authors.ID
GROUP BY Author
] [ ORDER BY
..Author
SELECT
GROUP BY
..ORDER BY AuthorID
Author ! SELECT

:
Group By
Criteria Pane
..Add Group By Group
By ..Group By
.
Group By

Column
.

:HAVING

HAVING
:
] [ SELECT Author, COUNT(AuthorID) AS
FROM Authors, Books
Where AuthorID = Authors.ID
GROUP BY Authors.Author
HAVING COUNT(AuthorID) > 1
] [ ORDER BY
:
HAVING .. Group
By AuthorID
Count Filter ..>1
Filter Group By
..Having
Where Group By
.Where

:SQL Joins
Joins
.. :
- .Cross Join
- .Left Join
- .Right Join
- .Full Join
- .Inner Join
.
:Cross Join

..


= ..:
SELECT Author, Book
FROM Authors, Books
)
(:
Author







Book

CROSS JOIN
:
SELECT Author, Book
FROM Authors CROSS JOIN Books
:
Book
Author
Delete :
.. ! ..

.. Authors.ID
.Books.AuthorID
:Left Join
) (
) .(ON
:
SELECT Book, Author
FROM Authors LEFT JOIN Books
ON AuthorID = Authors.ID
WHERE

NULL
.. ..
WHERE .
:
Book
Author

..Select All Rows From Authors : !
:Right Join

..:

SELECT Book, Author


FROM Authors RIGHT JOIN Books
ON AuthorID = Authors.ID


.NULL
AuthorID
Allow Nulls ..
.
:
Book
Author

..Select All Rows From Books : !
:Full Join

..:
SELECT Book, Author
FROM Authors FULL JOIN Books
ON AuthorID = Authors.ID


.NULL
:

Select All Rows
From Books ..Select All Rows From Authors
..
.
:Inner Join
WHERE
:

SELECT Book, Author


FROM Authors INNER JOIN Books
ON AuthorID = Authors.ID
:
Book
Author .. !

Select All Rows
From Books Select All Rows From .

..Outer Join OUTER
LEFT JOIN RIGHT JOIN FULL JOIN
OUTER .

:Action Queries

..

.
) (.
:

View
.. Views
Server Explorer New Query
..
SQL PANE
Execute SQL .

:DELETE

..WHERE :
DELETE FROM Books

WHERE Copies_No = 0
:
Books

Change Type
..Delete SQL DELET
.SELECT
Criteria Pane Copies_No
Filter:
=3
) (:
DELETE FROM Books
WHERE AuthorID = (SELECT ID
FROM Authors
)' ' = WHERE Author
..
.
From
WHERE
..Joins :
DELETE FROM Books
FROM Books INNER JOIN
Authors ON Books.AuthorID = Authors.ID
)' ' = WHERE (Authors.Author
WHERE:
DELETE FROM Books
FROM Books, Authors
WHERE AuthorID = Authors.ID AND
' ' = Authors.Author
:

Change Type
.Delete
Books ) ( Authors
.

Criteria Pane Authors.Author


Column Filter :
' ' =

:INSERT
INSERT
:
) ( ) VALUES ( INSERT INTO
..
..
..
:
)INSERT INTO Authors (Author, CountryID, About
)' ' ', 21, '( VALUES
ID ..

NULL ..
.


:
) ( VALUES INSERT INTO
: :
INSERT INTO Books
)', 14, 6, 7, '1/8/2000', 3, 2, 1000 '( VALUES
ID
..
ID
.
' ' SQL
.. NULL

) (image 0x0 .NULL
:



Change Type
..Insert Values SQL
INSERT SELECT :
) ( INSERT INTO
) ( VALUES

SQL
.. New Value
Criteria Pane
.
SELECT
Change
Type .Select
INSERT
VALUES
.SELECT
TempBooks
..
) ( :
INSERT INTO TempBooks
*SELECT Books.
FROM Authors, Books
' AND AuthorID = Authors.ID ' = WHERE Author
:
Authors Books
Author
Criteria Pane
Output Author
Filter ' ) : ' = (
SELECT
..TempBooks

Change
Type
..Insert Results
.. TempBooks ..
! SQL Pane

:UPDATE
UPDATE
:
UPDATE
, .. = , = SET
WHERE
: ) ( ) (:
UPDATE Authors
' ' = SET Author
' ' = WHERE Author
:
Authors
.Author

Change Type
Update Criteria Pane
Filter ') :Author ' =(
New Value Filter' : '
UPDATE SQL.

:UPDATE .WRITE
text ntext image

..
image :
UPDATE Publishers
SET Logo = @Logo
WHERE ID = 1
@Logo image ..

) (
Timeout .
Add Logo
..WriteLargeData .
:
UPDATE Publishers
SET Logo = Logo + @Logo
WHERE ID = 1

@Logo ..Logo

! image

) varchar(max), nvarchar(max), varbinary(max
)Binary Large Objects (BLOBs

Sequential
.
BLOBs :
) varchar(max .Text ) nvarchar(max .ntext ) varbinary(max .image T-SQL
:
_ UPDATE
) .WRITE (@Value, @Offset, @Length_ SET
Where
Write @Value
@Offset
..@Length :
).(MAX
..Null :

-
Update
.Update .Write
- Null

Default Value Or Binding
..
@Offset

.
@Value Null @Length
.@Offset
@Offset Null @Length @Value
.
@Offset ..
@Offset
Null .
@Length Null .@Offset

Logo2 Publishers
Update .Write WriteLargeData :
UPDATE Publishers
)SET Logo2 .WRITE (@Logo, @Offset , @Length
WHERE ID = 1
Logo2 ) varbinary(MAX
..
Byte

..
Update .Write ) (Loop
.Write ..

..

..


..
) ( ..
..
.. ..


.. Timeout

.. .
:
T-SQL UPDATETEXT
READTEXT WRITETEXT
image text ..ntext

.Update .Write

):Data Definition Language (DDL



Relations .Constrains

T-SQL
:
CREATE DATABASE
CREATE TABLE
CREATE PROCEDURE
CREATE FUNCTION
CREATE VIEW
CREATE INDEX
ALTER
..CREATE DROP
.CREATE
) :(Access

) (X
:
Create Table Authors
([Author] Text (30), [City] Text (20) Constraint X
)Unique
:
Create Table Numbers
)([No] Integer,[ID] Counter
X ID :
)Create Unique Index X On Numbers (No
Y :
ALTER TABLE Numbers
ADD COLUMN Y Long
:
ALTER TABLE Numbers DROP COLUMN Y

:Stored Procedures

T-SQL
Server .
:
- SQL Server Compile
SQL.
-
.
-
.
- SQL Injection
.
T-SQL
) (Transact-SQL SQL
.
:
CREATE PROCEDURE dbo.SP1
SP1 .
CREATE PROCEDURE
ALTER

PROCEDURE ..
CREATE PROCEDURE


.ALTER PROCEDURE
.. T-SQL
@ .. :
)@Str1 nvarchar(3
: .
" ", .

:
'' = )@Str2 nvarchar(7
)( .
AS RETURN :
AS

..
RETURN
:DECLARE
)DECLARE @Str3 nvarchar(7
:
'' = IF @Str3
BEGIN
'SELECT @Str3 = 'ABC
END
BEGIN :END
'' = IF @Str3
'SELECT @Str3 = 'ABC
SELECT ..@Str3
SET :SELECT
'SET @Str3 = 'ABC
SELECT
Aggregate Functions
:
)SET @Str3 = (SELECT Book FROM Books WHERE ID = 3



Server Explorer
Books.mdf ..SQL Sever
" " Stored
New Stored
Procedures
..Procedure .. :

CREATE PROCEDURE dbo.GetAuthorBooks


(
*/
*/
)@Author char(30
)
AS
''>< IF @Author
*/ */
BEGIN
*/ */
SELECT Book
FROM Books, Authors
WHERE Author = @Author
AND AuthorID = Authors.ID
END
*/ *RETURN /
.
T-SQL
../* */ ..
..--:
*/
*/
--
SELECT
..
" " ..Design SQL Block
Query Builder
.
SQL ..

..Insert SQL
.. SQL ..
SQL
.

..

..Run Stored Procedure ..
) ( ..OK
) ( .Output Window

:Access

..
Server Explorer
Stored Procedures
! Books.mdb



..Stored Procedures
..

:
- CREATE PROC CREATE
.PROCEDURE
- SQL
;.
-
..
.T-SQL
- @
.. .
- .RETURN
: !

:

(CREATE PROC DeleteAuthor


) )AuthorName VARCHAR(20
AS
DELETE FROM Authors
;)WHERE (Authors.Author = AuthorName




AccessStoredProcedure
" .."DeleteAuthor
"."GetAuhorBooks
Books.mdb \..C:
.

\ C: ..
DeleteAuthor GetAuhorBooks
..Stored Procedures
.
" " Factories
GetAuhorBooks .

SQL :User Defined SQL Functions


SQL
..RIGHT
.Functions

Functions New
..
T-SQL .

:User-Defined Table Types




..

.. :

) (
..
Table-Valued Parameter
.


.

..
T-SQL
.. CREATE TYPE
T-SQL :
AS TABLE_ CREATE TYPE
)_(
AuthorType
.. Books.mdf
New Query
:
CREATE TYPE AuthorType AS TABLE
( ID int,
Author nvarchar(50),
CountryID smallint,
Phone varchar(20),
) )About nvarchar(MAX
..Execute AuthorType
Programmability\Types\User defined Table Types

.

..

READONLY:
CREATE PROCEDURE UpdateAuthors
)(@Rows AuthorType READONLY
@Rows
SQL
.. : Authors @Rows
UPDATE INNER JOIN:
CREATE PROCEDURE UpdateAuthors
)(@Rows AuthorType READONLY
AS
UPDATE Authors
SET Authors.Author = R.Author,
Authors.CountryID = R.CountryID,
Authors.Phone = R.Phone,
Authors.About = R.About
FROM Authors INNER JOIN @Rows AS R
;ON Authors.ID = R.ID
RETURN
@Rows FROM
.. .R

ID
.

..INSERT :

CREATE PROCEDURE InsertAuthors


)(@Rows AuthorType READONLY
AS
INSERT INTO Authors
)(Author, CountryID, Phone, About
SELECT R.Author, R.CountryID, R.Phone, R.About
FROM @Rows AS R
RETURN
:
INSERT INTO Authors
*SELECT R.
FROM @Rows AS R
ID
Author.ID
AuthorType.ID .
ReadOnly

..
..INSERT:
;DECLARE @TEMP AuthorType
INSERT INTO @TEMP
*SELECT R.
;FROM @Rows AS R
) (
ID .
@TEMP
.
TableValuedParameters

.. Command .

ADO.NET
Server :Client
Server
SQL Server
.
Client
.
Clients


.
:
) (
.

.



.


.


Thread ..
RAM
..


..
:
..
SQL .
Cashed
..


.

SQL Processor
RAM
.


! ..
..
.

:ADO.NET
ADO " "
ActiveX Data Object
Classes
..

.



..
ADO

..

.
ADO

ADO.NET
" " Disconnected Mode


.
ADO.NET
:
..Connection object
.

Command Object SQL Query .


: . Data Reader
.
. " " Data Adapter
Data Set

Relations Constraints

Referential Integrity .
..
.Data Bound Controls

.
: Layers

.
:


Database

Server
Client

Connection Object

Command Object

Data Adapter

Data Reader

Data Set

Data-Bound Controls

: Namespaces ADO.NET
- System.Data
- System.Transactions
- Microsoft.SqlServer.Server

:XML
XML " "
Extensible Markup Language
.. XML
.
Binary Files

.. XML

.. ADO.NET
XML .
XML
ADO.NET
XML .
XML
DataSet ..

.. .

:Database Providers
ADO.NET Providers
.. :
:ODBC -
"
":
Open Database Connectivity



.
:
System.Data.ODBC
:OLE DB -

"
":
Object Linking and Embedding Database
Provider COM
ODBC
)
(
) (
SQL
Spreadsheets .Excel
:
System.Data.OleDb
:SQL Server -


.
:
System.Data.SqlClient .
System.Data.SQL

.
System.Data.SqlTypes
Data Types



Microsoft.SqlServer.Server
.

:SQL Server Compact 3.5 -



SQL Server Compact Edition

Windows CE
..NET Compact Framework
:
System.Data.SqlServerCe

:
system.data.sqlserverce.dll
:Oracle -

.
System.Data.OracleClient :

:
System.Data.OracleClient.dll

) Connection Command
DataAdapter DataSet ...DataReader
( :
SqlCeConnection
SqlConnection
OdbcConnection
OleDbConnection
OracleConnection
SqlCeCommand
SqlCommand
OdbcCommand
OleDbCommand
OracleCommand
SqlCeDataAdapter

SqlDataAdapter
OdbcDataAdapter
OleDbDataAdapter
OracleDataAdapter
SqlDataSet
OdbcDataSet
OleDbDataSet
OracleDataSet
SqlCeDataReader
SqlDataReader
OdbcDataReader
OleDbDataReader
OracleDataReader


Connection Object

..
sqlConnection
:
Imports System.Data.SqlClient

:Connection String

..
; :
Property1 = Value1; Property2 = Value2; ..
PropertyN = ValueN

:
;Data Source = .\SQLEXPRESS
;AttachDbFilename = C:\Books.mdf
;Integrated Security = True
;Connect Timeout = 30

:
ODBC
} { :
;}Property1 = {Value1
Property2 = {Value2}; .
}PropertyN = {ValueN

.

..

" " DbConnectionStringBuilder
.. :

SqlConnectionStringBuilder .
OleDbConnectionStringBuilder .OLEDB
OdbcConnectionStringBuilder .ODBC
OracleConnectionStringBuilder .







DbConnectionStringBuilder Class
System.Data.Common
IDictionary Collection
Key ..Value


DbConnectionStringBuilder
.
System.Data.Common
:
Imports System.Data.Common
Constructor :
- ..:
Dim CsB As New DbConnectionStringBuilder
- Boolean True
} {
.ODBC
:
:ConnectionString
..
..ToString

.
:BrowsableConnectionString
True
PropertyGrid
.
:
:AppendKeyValuePair


StringBuilder
.
: StringBuilder
..:
(Dim SB As New System.Text.StringBuilder
)";"Data Source = .\SQLEXPRESS
DbConnectionStringBuilder.AppendKeyValuePair(SB,
)""AttachDbFilename", "C:\Books.mdf
DbConnectionStringBuilder.AppendKeyValuePair(SB,
)""Integrated Security", "True
)MsgBox(SB.ToString
:
Data Source = .\SQLEXPRESS; AttachDbFilename
= C:\Books.mdf; Integrated Security=True

True }{
.ODBC
:EquivalentTo
DbConnectionStringBuilder
..DbConnectionStringBuilder

) (
..
..
..True
EquivalentTo
.ConStrBuilder

:ShouldSerialize
True
.. ..ContainsKey
ShouldSerialize
.ConStrBuilder
:TryGetValue

True False
.. Item

ContainsKey ..:
If CSB.ContainsKey("AttachDbFilename") Then
MsgBox(CSB("AttachDbFilename")) ' C:\Books.mdf
End If
TryGetValue :
ByRef Object
.. :
Dim Value As Object
If CSB.TryGetValue("AttachDbFilename", Value) Then
MsgBox(CSB("AttachDbFilename")) ' C:\Books.mdf
End If







SqlConnectionStringBuilder Class
DbConnectionStringBuilder


.
:
- .
-
.
:
:AttachDBFilename
AttachDBFilename initial file name
..

.
Read Only
Log

.
Log
Database
..
.
:InitialCatalog
..


) ..(Books
AttachDBFilename
.

database Initial Catalog


.. .
:DataSource
..
.\SQLEXPRESS Remote Server
IP Address ).(10.0.0.127
Data Source server address
addr network address ..
.
:FailoverPartner

.
Failover Partner ..
.
:IntegratedSecurity
trusted_connection Integrated Security
.. False
.. True
..

LAN
System Administrator

.
:UserID

.Integrated Security
User ID user uid ..
.

:Password

.Integrated Security
Password pwd ..
.
:WorkstationID

Workstation ID wsid ..
.
:PersistSecurityInfo
Persist Security Info persistsecurityinfo
.. False
..
True
.
:ConnectTimeout

Connect Timeout
connection timeout timeout ..
.
:ApplicationName
app Application Name ..
.NET SqlClient Data Provider
.
:CurrentLanguage

language Current Language ..
"".

:Encrypt
Encrypt ..
False
.. True
SSL Encryption " "
Secure Sockets Layer Encryption :
Public Key Private Key
.
:TrustServerCertificate
TrustServerCertificate
True Certification
.SSL
:ContextConnection
Context Connection ..
.False
True
Local Server T-SQL


Transactions
..

)
( .
False Regular
Connection ) ( Remote
.Server
..

Network
Layers
.In-Process Interface

:Enlist
Enlist ..
True
..Current Transaction Context
Transaction

.. Transactions

.
:AsynchronousProcessing
async Asynchronous Processing
.. False
True ..

..
Threads

.

:Pooling
Pooling ..
True
Connection Pool
.. False

...
:MaxPoolSize
Max Pool Size ..

.
:MinPoolSize


Min Pool Size ..
.
:LoadBalanceTimeout

Connection Pool

..
.
connection
lifetime
Load Balance Timeout .
:ConnectionReset
Connection Reset ..
True

.Connection Pool

:MultipleActiveResultSets
MultipleActiveResultSets ..
False "
" Default Result Set
Buffer

..

..

Packets .Network
True "
" Multiple Active Result Sets MARS

SqlDataReader
.
:NetworkLibrary
DLL
.
Network Library network net
.. ..
:

Named Pipes
Multiprotocol
AppleTalk
VIA
Shared Memory
IPX/SPX
TCP/IP


dbnmpntw
dbmsrpcn
dbmsadsn
dbmsgnet
dbmslpcn
dbmsspxn
dbmssocn


.(Shared Memory) dbmslpcn
:PacketSize

..Packets
Byte .Byte
Packet Size .
:Replication
Replication ..
False True
Replication

..

.
:TransactionBinding
Transaction Binding ..
:
Implicit Unbind
Explicit Unbind

:

.Current Transactions
:

.

:TypeSystemVersion
Type System Version

..
SQL Server 2000
Data Types

..
:
SQL Server
2000

SQL Server
2005
SQL Server
2008
Latest

..

:
XML .NTEXT UDT .VARBINARY ) VARCHAR(MAX .TEXT ) NVARCHAR(MAX .NEXT ) ARBINARY(MAX .IMAGE .
.


.
:UserInstance
User Instance ..
False True

FILESTREAM
.
Methods .

:
Dim CnStrBldr As New SqlConnectionStringBuilder
"CnStrBldr.DataSource = ".\SQLEXPRESS
"CnStrBldr.InitialCatalog = "Books
CnStrBldr.IntegratedSecurity = True
Dim CnStr = CnStrBldr.ConnectionString
)MsgBox(CnStr

:Settings



..


.

) (
.



..

) ( ..
Settings
" "

..ConnectionStringsSection
. J
:
Solution Explorer ..My Project .
Settings .
Name .BooksConStr Type ) ..(Connection String
Scope .Application
..Value
..Server Explorer
.. ..

..Advanced :


..SqlConnectionStringBuilder

.
OK .. .Value


.
.
BooksConStr Settings
My .. :
)MsgBox(My.Settings.BooksConStr
BooksConStr

app.config
BooksConStr ><connectionStrings
.







ConnectionStringsSection Class
System.Configuration
ConfigurationSection .
:
:ConnectionStrings
ConnectionStringSettingsCollection
ConfigurationElementCollection

ConnectionStringSettings Class .

.
OpenxxConfiguration
ConfigurationManager
Configuration Object
ConnectionStrings
ConnectionStringsSection:
Dim Cnfg = ConfigurationManager.OpenMachineConfiguration

Dim CnStrSett = Cnfg.ConnectionStrings


ConnectionStringSettings Class
ConfigurationElement Class
.
:
- .
- :
.
-
Provider .
:
:Name
.
:ConnectionString
.
:ProviderName
.

Shared Property:
Dim CnStrSett = ConfigurationManager.ConnectionStrings
:

Dim CnStrSett = ConfigurationManager.ConnectionStrings


For Each CnStr As ConnectionStringSettings In CnStrSett
)MsgBox(CnStr.Name
)MsgBox(CnStr.ProviderName
)MsgBox(CnStr.ConnectionString
Next
:

.
> <ConnectionStrings

AddAppSettings .







IDbConnection Interface
IDisposable
..Implements the interface

.
IDbConnection :
:ConnectionString

..
.
:ConnectionTimeout


..

! ..


Thread
.


.. ..

) (.
:Database
.

:State
ConnectionState
:
Closed
.
Open
.
Connecting .
Executing
.
Fetching .
Broken
..
.
:
:Open

.ConnectionString
:ChangeDatabase


..Database
! ..

.
:CreateCommand
Command Object
..

Connection ..
.
" "
IDbCommand .

:BeginTransaction
Transaction Object

.. "
" IDbTransaction .

" " ..IsolationLevel
.
:Close
Rollback Transactions
..Committed .
Pooling

..
Close
Connection Pool
.

DbConnection Class
Abstract Base Class MustInherit
IDbConnection Component
Class Component
Tray
SQLConnection ..
Toolbox Data
Choose Items
SQL
SQLConnection ..OK
Data .. SQLConnection
.
IDbConnection
:
:DataSource
.
:ServerVersion
..
.
IDbConnection
:
:EnlistTransaction
Transaction Object

Distributed Transaction
..
.
:GetSchema

DataTable Object
.

.

String Array Restrictions
.
:
:StateChange
) ( .. e
StateChangeEventArgs
:
OriginalState ConnectionState
.
CurrentState ConnectionState

) (.
:DbConnection
.SqlConnection .
.OdbcConnection .
.OleDbConnection .
.OracleConnection .
..
.SqlConnection

SqlConnection Class
DbConnection
Component .IDbConnection

:
:FireInfoMessageEventOnUserErrors
True InfoMessage

.. False
Exception
InfoMessage .
:PacketSize
) (Byte .
:StatisticsEnabled
True
..
..
.False
:WorkstationId
.
IDbConnection
:

:ChangePassword

..
UserID
Password
IntegratedSecurity .

Connection
.Pool

Expired ..
Open
SqlException Number

.

:
Dim Csb As New SqlConnectionStringBuilder
"Csb.DataSource = ".\SQLEXPRESS
"Csb.InitialCatalog = "Books
"Csb.UserID = "User1
"Csb.Password = "2009
)Dim Cn As New SqlConnection(Csb.ToString
Try
)(Cn.Open
Catch ex As SqlException
If ex.Number = 18487 OrElse ex.Number = 18488 Then
)"SqlConnection.ChangePassword(Csb.ToString, "2010
End If
End Try

:ClearPool
SqlConnection Object
..Connection Pool


Close
..:
)SqlConnection.ClearPool(Cn
:ClearAllPools

Connection Pool
Close ..:
) (SqlConnection.ClearAllPools
:EnlistDistributedTransaction
.EnlistTransaction
:RetrieveStatistics
IDictionary
Keys Values ..

..
StatisticsEnabled True.
:ResetStatistics
.
:

:InfoMessage
.. e
SqlInfoMessageEventArgs
:
Errors

Message
Source

SqlErrorCollection
ICollection
SqlError

..
SqlError .

..Errors
.

..Errors
.

AuthorBooks_Reader
..
Load FormClosing
..
Local Variable
Connection
Command Object
..
Connection
:
) (Cmd.Connection.Close

..


.

..



!

! J



)
(



) ( !

..

Connection Pooling

..
Pooling
.
.AuthorBooks_Reader2

SqlError Class
) (
.. :
:Class
.. .
:Server
.
:Source
Provider .
:Procedure
.
:LineNumber
.
:Message
.. .. ToString
.
:Number
.
:State
.
:
SqlException
SystemException Exception
SqlError
InfoMessage
.Exception Handling

Command Object

SQL Stored Procedure


.
.

IDbCommand Interface
IDisposable
..System.Data :
:Connection
IDbConnection
..
.
:CommandType

CommandType:
..SQL
Text
.
StoredProcedure .
TableDirect

..

.

:CommandText
SQL
.CommandType
SQL
;
Resultsets
..SELECT
.
:CommandTimeout
..


.
:Parameters
" "
IDataParameterCollection ..IList

.. .
:Transaction
IDbTransaction
.
:UpdatedRowSource
DataRow
..DataSet
Update Command
DbDataAdapter ..


Output Parameters SELECT
..
) (
) (..


UpdateRowSource:
None

.
OutputParameters
Output Parameters
.DataSet
FirstReturnedRecord
.
Both

.
:
:Prepare

..
CommandType .TableDirect


.
:CreateParameter
IDbDataParameter
.
:ExecuteNonQuery
Integer
..
Update Delete .Insert
CREATE PROC
AccessStoredProcedure
..Access
OleDbCommand Access
ExecuteNonQuery SQL
.


..
..
DbTasks
MyDbConnector ConnectionStr
Constuctor
..

..ExcuteCommand :
CommandText .. SQL

SQL " "insert " ..."update
..CommandType.Text

) (UpdateAuthors
..
.CommandType.StroresProcedure
) String(, ..

..Command.Parameters
.Nothing
Command.ExecuteNonQuery
True False .


..
:MyDbConnector

(Dim DbBooks As New MyDbConnector


)My.Settings.BooksConStr
& " Dim SQL = "INSERT INTO Authors
& ")" (Author, CountryID, About
")" VALUES (@Author, 21, @About
Dim Params = {{"@Author", TxtAuthor.Text.Trim},
}}{"@About", TxtAbout.Text.Trim
If DbBooks.ExcuteCommand(SQL, Params) Then
)(TxtAuthor.Clear
)(TxtAbout.Clear
End If
MyDbConnector
..ExcuteCommand

:ExecuteReader
IDataReader
.. .
.AuthorBooks_Reader

CommandBehavior :
Default


) Result Sets
SQL ( ..
ExecuteReader .
SingleResult
.
SchemaOnly
..
..
:
SET FMTONLY ON

KeyInfo
.Primary Key
SingleRow

..

.
Sequential ..
Access

.. :


.
GetValue .
GetBytes
image ).varbinary(MAX
GetChars
text ntext )varchar(MAX
).nvarchar(MAX
ReadLargeData
Publishers
..
..
Logo
image
Logo2 ).varbinary(MAX
Close
Connection
Connection .
.Or
GetReader MyDbConnector
DbTasks

ExecuteReader ..

..
CommandBehavior.CloseConnection
ExecuteReader
.. GetReader
Sequential True

False .
" " ..
.
:ExecuteScalar
Object
.
.Aggregate Functions
AvgPrice
.
GetValue MyDbConnector
DbTasks
ExecuteScalar
" ".
:Cancel
..
.

DbCommand Class
Abstract Base Class MustInherit
Component Class
IDbCommand .
IDbCommand
:
:DesignTimeVisible
) True (
.

.IDbCommand
:DbCommand
.OdbcCommand Class .
.OleDbCommand Class .
.SqlCommand Class .
.OracleCommand Class .
.SqlCommand

SqlCommand Class
DbCommand
.
:
. .
.
.CommandText
.
SqlConnection .
.
SqlTransaction .
:

:Notification
SqlNotificationRequest
..
SqlNotificationRequest.
:NotificationAutoEnlist
True
..SqlDependency
ASP.NET Cashed
Page ..
SqlDependency.
:
:Clone
SqlCommand .
:ResetCommandTimeout
CommandTimeout .
" :ExecuteXmlReader "XML
XMLReader
..XML :
FOR XML .. .XML
.XML ntext nvarchar .XML
XML
.
SqlCommand
Asynchronous Operations
:

EndExecuteXmlReader
BeginExecuteXmlReader
EndExecuteNonQuery
BeginExecuteNonQuery
EndExecuteReader
BeginExecuteReader
Begin

.. IAsyncResult
End
.


..Callback Function

.
SqlCommand :
:StatementCompleted
..
e StatementCompletedEventArgs
" " RecordCount
.

:
" " ..
SQL CommandText
) :(Cmd
Cmd.CommandText = "SELECT Books.Book " +
"FROM Authors, Books " +
"WHERE Authors.ID = AuthorID " +
"' ' = "AND Authors.Author
..


)
(TxtAuthor ..
:
Cmd.CommandText = "SELECT Books.Book " +
"FROM Authors, Books " +
"WHERE Authors.ID = AuthorID " +
"'""AND Authors.Author = '" + TxtAuthor.Text +


.

!
.. .

:SQL Injection

..WHERE




!


Shell
!
Injection
- Hacker


'
.SQL
- ; SQL
!
- SQL
--

!
:
Ahamd'; drop table Books- :
SELECT Books.Book
FROM Authors, Books
WHERE Authors.ID = AuthorID
'AND Authors.Author = 'Ahamd'; drop table Books--
: :
.Ahmad ..


!
' !



.J

:
-
Lists .
- MaxLength
..
.
-
; ' .. */ /* --
..
.KeyPress
- SQL
DROP DELETE UPDATE .INSERT
- :
AUX, CLOCK$, CON, CONFIG$, NUL, PRN
COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8

LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8


-
) (

..


!
- _ xp

Catalog-extended stored procedures .xp_cmdshell

Stored
- Procedures


.
-
:
EXECUTE, EXEC, sp_executesql
- Parameters
Concatenation
..
:

.
AuthorBooks_Reader SqlInjection


.
SqlInjection DbTasks
.
.

:Parameters
Placeholder SQL
..
.

@
) ..(@UserName :
Cmd.CommandText = "SELECT Books.Book " +
"FROM Authors, Books " +
"WHERE Authors.ID = AuthorID " +
""AND Authors.Author = @Author

@Author
.
OLEDB ODBC ?
:

Cmd.CommandText = "SELECT Books.Book " +


"FROM Authors, Books " +
"WHERE Authors.ID = AuthorID " +
"? = "AND Authors.Author

)
? ( ..
:

Cmd.CommandText = "SELECT Books.Book " +


"FROM Authors, Books " +
"WHERE Authors.ID = AuthorID " +
""AND Authors.Author = AuthorValue
AuthorValue ..
@Author
!


AuthorID AutherID


..

:
"No value given for one or more required parameters


! ..
!


DbCommand.Parameters
..



.

..
@Author
.@Author
OLEDB ODBC ?
DbCommand.Parameters
..


X ..@Author
..
? .

" " Factories
.
.


DbParameterCollection Class
IDataParameterCollection
..IList DbParameterCollection
DbParameter .

.
DbParameterCollection
:
OdbcParameterCollection Class .
OleDbParameterCollection Class .
SqlParameterCollection Class .
OracleParameterCollection Class .

.SqlParameterCollection Class


SqlParameterCollection Class
DbParameterCollection
SqlParameter .
Add
:
:Add
:
- .SqlParameter
-
SqlDbType .
-
Integer .

-
DataSet .
-
Object

AddWithValue .
:AddWithValue
Object
.. .

DataReader DataTable
..
Table-Valued Parameter
..
..TableValuedParameters
OledbDataReader
AddWithValue
InsertAuthors
.

AddWithValue
ExecuteNonQuery
.

IDataParameter Interface
System.Data :
:ParameterName
@ .@UserName
:IsNullable
True ..DBNull
.False
:Direction
ParameterDirection:
Input
.
Output

.. !
InputOutput .
ReturnValue .
:Value
Object
DbType
.


DataReader
.
DBNull DBNull:
P.Value = DBNull.Value

Value
Shared ReadOnly Property DBNull
.DBNull

:DbType
DbType:

SByte
Byte
Binary
Boolean
Int16
UInt16
Int32
UInt32
Int64
UInt64
Single
Double
Currency

-
.

.




False True

-




-





-

(- ^ )

(^)
.
(-^)

(^)
.
^ - )- ( ^


Decimal
VarNumeric

Guid
Time
Date
DateTime
DateTime2

(-^)

(^)
.


.

//

//
//

//

DateTime
Offset
String

StringFixed

AnsiString

AnsiString
Fixed
Length

Xml
Object

XML

Length



.Unicode

.Unicode

.ASCII

.ASCII
XML .

.

:SourceColumn
DataSet ..

..Update Command :
Update Comman SourceColumn
.
DataAdapter
.

DbParameter.SourceColumn
.

DataAdapter .DataSet
:SourceVersion
..

) (
) ( ..
..DataRowVersion
.


IDbDataParameter Interface
IDataParameter
..
:

:Size
..Byte


..
.

:Precision
..

.

:Scale

.. ..
.

DbParameter Class
System.Data.Common
IDbDataParameter
IDataParameter
:

:SourceColumnNullMapping
True
SourceColumn

..
Null
False ! ..
..
.
:
:ResetDbType
DbType .
:
OdbcParameter Class .
OleDbParameter Class .
SqlParameter Class .
OracleParameter Class .
.SqlParameter

SqlParameter Class
DbParameter
.


.. ..
:
. SqlDbType . ..Bytes ..
) (MAX .-
ParameterDirection . Byte ) .(Precision
Byte ) .(Scale
. DataRowVersion .. .
True Null
.
Object .. Nothing
.
XmlSchemaCollectionDatabase .





XmlSchemaCollectionOwningSchema .
XmlSchemaCollectionName .

..Current Value
.
Book :
Dim PrmBook As New SqlParameter("@Book",
)"SqlDbType.NVarChar, 0, "Book
ID
:
Dim PrmID As New SqlParameter("@Original_ID",
SqlDbType.Int, 0, ParameterDirection.Input, False, 0,
)0, "ID", DataRowVersion.Original, Nothing
Update:
Dim UpdateCmd As New SqlCommand
_ & " UpdateCmd.CommandText = "UPDATE Books
""SET Book = @Book WHERE ID = @Original_ID
UpdateCmd.Connection = Me.SqlConnection1
(UpdateCmd.Parameters.AddRange
)}New SqlParameter( ) {PrmBook, PrmID
:
DaAuthorBooks.UpdateCommand = UpdateCmd
Load
..ViewAndEditBooks
DaAuthorBooks
Update .
SqlParameter :
:LocaleId

.. :
) . 0x0001 : " : "
(.

:CompareInfo

) SqlCompareOptions .(
:Offset
..Value
Bytes
Characters ..
.
Size
..Offset Value

.. Offset
Size ) ..(
Loop )
Offset (Size
Offset ..

..Value
..Update .Write Parameter.Offset
Write Large Data
Logo2 ..
Value
..

..

Update
.Write .

:SqlDbType

SqlDbType
..
.NVarChar
DbType
SqlDbType

..DbType :
Dim P As New SqlParameter
P.SqlDbType = SqlDbType.Money
MsgBox(P.DbType.ToString("g")) ' Currency
P.DbType = DbType.Int64
MsgBox(P.SqlDbType.ToString("g")) ' BigInt
:TypeName
Table-Valued
..Owner
AuthorType
InsertAuthors ""dbo.AuthorType
" "AuthorType ..
SqlDbType ..SqlDbType.Structured
.TableValuedParameters
:UdtTypeName
User-
Defined Type
SqlDbType ..SqlDbType.Udt
.
:SqlValue
Value .

:XmlSchemaCollectionDatabase
..XML


XmlSchemaCollectionName

XmlSchemaCollectionOwningSchema .
:XmlSchemaCollectionName
.XML
:XmlSchemaCollectionOwningSchema
.XML

DataReader
DataReader ExecuteReader
..Command Object

Network Buffer

:
- :
.
- :
.
:
- .. :
!
-
.
" ":
Forward-only, Read-only Stream.
:
- .
-
.
-
.
-
.

IDataRecord Interface

.
:
:FieldCount
.. Loop

..FieldCount - 1
.
:Item
Default Property
Object
..
:
))MsgBox(Reader.Item(0
:
))MsgBox(Reader(0
:
:GetName
.
:GetOrdinal
.
:GetFieldType
Type
.
:GetDataTypeName
.

:GetValue
Object
.
:GetValues
Object Array
..

..

..
.
:GetBytes
Sequential
Bytes ..
:
. . Bytes .. .
. Bytes ..
.

Nothing
.
ReadLargeData
Byte

..
GetBytes
.

:GetChars
Sequential
Char Array

.
:IsDBNull
True ..DbNull

..NULL
:
))If Not Reader.IsDBNull(0) Then MsgBox(Reader(0

..

:

.Byte
GetByte
.Char
GetChar
.Boolean
GetBoolean
.Short
GetInt16
.Integer
GetInt32
.Long
GetInt64
.Single
GetFloat
.Double
GetDouble
.Decimal
GetDecimal
.DateTime
GetDateTime
.String
GetString
.Guid Structure
GetGuid

.

DbDataRecord Class
IDataRecord
.

.

IDataReader Interface
IDisposable .IDataRecord
:
:Depth

) ... (
... .
:IsClosed
True .
:RecordsAffected
..

- .SELECT

IsClosed True
RecordsAffected .Close
:

:Read
..True
False
.
-


:
Invalid attempt to read when no data is present.
Read
False :
Do While Reader.Read
'
Loop
:NextResult
SQL


.. True
False :
Do
Do While Reader.Read
'
Loop
Loop While Reader.NextResult
:GetSchemaTable
DataTable
.. .
..
..SchemaTable

GetSchemaTable

DataGridView
.
:Close
..

.

ExecuteReader ) Cmd (:
(Dim Dr = Cmd.ExecuteReader
)CommandBehavior.CloseConnection
Dr
.Close

DbDataReader Class
:
System.Data.Common
IDataReader
IDataRecord ..IDisposable
IEnumerable GetEnumerator

..DbDataRecord
Read
For Each :
For Each R As DbDataRecord In Dr
)) (MsgBox(R(0).ToString
)) (MsgBox(R(1).ToString
Next

Dr .
DbDataReader
:
:HasRows
True .
:VisibleFieldCount
.
:
:GetProviderSpecificFieldType
Type
..
..

SqlString .String

:GetProviderSpecificValue
Object ..

) (:
)Dim Name As String = Dr.GetProviderSpecificValue(0
)MsgBox(Name
:
)Dim Name As SqlString = Dr.GetProviderSpecificValue(0

)MsgBox(Name.Value
:GetProviderSpecificValues
Object Array
..
.
:DbDataReader
DataTableReader Class -
OdbcDataReader Class -
OleDbDataReader Class -
SqlDataReader Class -
OracleDataReader Class -
SqlDataReader
.DataTableReader

SqlDataReader Class
DbDataReader
.

ExecuteReader .SqlCommand


..
GetX X ..
:
GetSqlBoolean
GetSqlBinary
GetSqlBytes
GetSqlByte
GetSqlDateTime
GetSqlChars
GetSqlDouble
GetSqlDecimal
GetSqlInt16
GetSqlGuid
GetSqlInt64
GetSqlInt32
GetSqlSingle
GetSqlMoney
GetSqlValue
GetSqlString
GetSqlXml
GetSqlValues
GetTimeSpan
GetSqlBinary SqlBinary
image
) varbinary(MAX GetSqlBinary
ReadLargeData ) Logo2
(Logo ..
) (

!
GetSqlBytes
SqlFileStream.Read ..ReadLargeData
GetSqlBytes
.Transaction Context

..
..AuthorBooks_Reader

" "
.
C:
.
:
GetAuthorBooks

:AuthorBooks_Reader
CommandText .GetAuthorBooks
CommandType .StoredProcedure
@Author .

:
.SQL
AuthorBooks_Reader2 .

DataAdapter

Connection Object
DataSet
.

Command Objects SQL
SELECT UPDATE INSERT
DELETE
) (
DataReader .
Data Reader
..

Table Mapping

.
.

IDataAdapter Interface

:
:TableMappings
ITableMappingCollection

..
.
:MissingMappingAction

MissingMappingAction
.
Passthrough

.
:MissingSchemaAction

MissingSchemaAction
.
Add
.
:
:Fill
DataSet
SELECT
..
:

- Primary Key
Unique Constraint
.
-
!
.

..
.
Table
Mapping ..
:
-
.Table
-

Table Table1 ...Table2 ..

.
-
..
Table Table

! ..

.
-
.
-
) (
) ( ...
.
- ) (
Column1 Column2
...Column3.


.
Fill
..DataGridViewAuthorBooks
DAAuthors
DABooks
.. Ds
:Form1_Load
)DAAuthors.Fill(Ds
)DABooks.Fill(Ds
:FillSchema
..Schema

.. :
.
:
DataSet . SchemaType Mappings
:
Source

.Schema
Mapped

.

:
. : . .AllowDBNull
. .Unique
. .ReadOnly
. ..AutoIncrement
.
. .MaxLength
Primary Key ..
Unique

) ..(AllowDbNull = False
NULL
UniqueConstraint
ConstrainsCollection
.
!
DataTable Array
.
Fill
.. Fill

FillSchema.
..

..
UpdateErrors

.


Fill


DataSet.Merge
....
:GetFillParameters
IDataParameter Array
SELECT
.
:Update
DataSet
..
.


..
.


..
..
..
.


.. :
Update
..
Update
.. :
)DaAuthors.Update(Ds

)DaBooks.Update(Ds




Foreign Key Constraint
..

.. :
)DaBooks.Update(Ds
)DaAuthors.Update(Ds
" "
.DataSetSample







IDbDataAdapter Interface
IDataAdapter
.
:
:SelectCommand
IDbCommand
SELECT
Fill
..FillSchema
Batch SQL
.
:InsertCommand
IDbCommand
INSERT
Update
.
:
INSERT INTO Authors
)(Author, CountryID, Phone, About
)VALUES (@Author, @CountryID, @Phone, @About
CopyAuthors
InsertCommand
Update
..
..
Parameter Object SourceColumn
..
New
:
{ ) (InsertCmd.Parameters.AddRange(New SqlParameter
New SqlParameter("@Author",

SqlDbType.NVarChar, 0, "Author"),
New SqlParameter("@CountryID",
SqlDbType.SmallInt, 0, "CountryID"),
New SqlParameter("@Phone",
SqlDbType.VarChar, 0, "Phone"),
New SqlParameter("@About",
)})"SqlDbType.NVarChar, 0, "About

Update

.

:

SELECT
; ..:
INSERT INTO Authors
)(Author, CountryID, Phone, About
;)VALUES (@Author, @CountryID, @Phone, @About
SELECT * FROM Authors
) (WHERE ID = SCOPE_IDENTITY

.. :

)
(-
SELECT
.
.
SCOPE_IDENTITY
..
@@IDENTITY

Triggers
.
:DeleteCommand
IDbCommand
DELETE

Update
.
:UpdateCommand
IDbCommand
UPDATE
Update
.
:

SelectCommand

Update
CommandBuilders
.






DataAdapter Class
IDataAdapter .Component
Constructor
Protected .
IDataAdapter
:
:AcceptChangesDuringFill
) True (
DataRow.AcceptChanges

..
False




..
:
- AcceptChangesDuringFill
.False
- Fill
.
-
Update
.
CopyAuthors
..
Update
.

:AcceptChangesDuringUpdate
) True (
DataRow.AcceptChanges


.. False



.. :

:


False

AcceptChangesDuringUpdate
.Update


True

AcceptChangesDuringUpdate
..Update

.
UpdateAll




.
Wizard
..
..
UPDATE
) ID ( ..


..

..


.
:ContinueUpdateOnError
True

RowError
DataRow .
False
..
..
UpdateErrors
Check Box ..
" "
.


Null
..

CountryID
FOREIGN KEY constraint
.

Try Catch
.



....
..
.

:

If ChkContinue.Checked Then
'
DaAuthors.ContinueUpdateOnError = True
)DaAuthors.Update(Ds
'
' .
' Else
DaAuthors.ContinueUpdateOnError = False
Try
)DaAuthors.Update(Ds
Catch ex As SqlException
)MsgBox(ex.Message
End Try
End If


Binding ..
.




.. :
" " ..

..
..

..
..
UpdateErrors2
..


DataGridView.DataError
.

:FillLoadOption
Original Version
Current Version Fill
.
LoadOption:
OverwriteChanges

.
PreserveChanges


.
Upsert


.
:ReturnProviderSpecificTypes
True Fill
) ( ..
False Fill
.
:

:ResetFillLoadOption
FillLoadOption
Fill .AcceptChangesDuringFill

:ShouldSerializeAcceptChangesDuringFill
True
.AcceptChangesDuringFill
:ShouldSerializeFillLoadOption
True
.FillLoadOption
DataAdapter :
:FillError
.. e
FillErrorEventArgs :
DataTable DataTable
.
Exception
Errors
.
Values Object Array
.
Continue True
..
False .

DbDataAdapter Class
.DataAdapter
:
:DefaultSourceTableName
Table
.
:UpdateBatchSize

..
Round Trips
..
)
(
.

.. .
:
.. .
<
; .

.
> !

UpdatedRowSource
None OutputParameters
.
Fill
..FillSchema :

:Fill
:
- DataTable ..
MyDbConnector.GetTable
DbTasks DataTable
..

..
GetTable " "
.
-
..
:TblBooks
)"DaBooks.Fill(Ds, "TblBooks
MsgBox(Ds.Tables(0).TableName) 'TblBooks
- :
. .
.. .
. -
:
. . ParamAray DataTable Array
.

.
:FillSchema
:

- DataTable
SchemaType .
-
SchemaType .
DataTable .
:DbDataAdapter
OdbcDataAdapter Class .
OleDbDataAdapter Class .
SqlDataAdapter Class .
OracleDataAdapter Class .
.SqlDataAdapter






SqlDataAdapter Class
DbDataAdapter
.
:
- .
- SelectCommand
.
- :
.SELECT SqlConnection .
SqlCommand
SELECT CommandText
Connection
..
SelectCommand ..
.
-
Connection String
.SqlCommand

:
:RowUpdating
Update
..

.
e SqlRowUpdatingEventArgs
:
Command SqlCommand
.

Exception
Errors
..
) .(RowUpdated
DataRow
Row
.
Statement
StatementType:
Type
:Select . :Insert . :Update . :Delete . :Batch .Status

UpdateStatus:
:Continue .
:ErrorsOccurred
..

Update
.Try Catch
:SkipCurrentRow
.
:SkipAllRemainingRows
.
Table
DataTableMapping
Mapping
.

:RowUpdated

.
e SqlRowUpdatedEventArgs
SqlRowUpdatingEventArgs
:
RecordsAffected
..

-
SELECT
..
SELECT

!
RowCount

UpdateBatchSize




..

UpdateBatchSize
)
(.
CopyToRows UpdateBatchSize
e.Row

..

DataRow Array


By Reference

..


.e.RowCount



.
:
RowUpdating
..CopyToRows RowUpdating

Batch SQL
..
) RowUpdating (


RowUpdated .
RowUpdated
Update
Concurrency Violation ..

.
.. Concurrency
.

:


.. :
" " .
" "
.
:
" "
!

!
..


!
..Concurrency Problem
:
- :Pessimistic Concurrency
" "


Lock

..
Transactions
.


..
:
UPDATE Authors

SET Author = @Author,


CountryID = @CountryID,
Phone = @Phone,
About = @About
;WHERE ID = @ID

.


..


.





..


Transactions Rollback
.
- :Optimistic Concurrency
ADO.NET

.
..

.. :
.
..
:
UPDATE Authors

SET Author = @Author,


CountryID = @CountryID,
Phone = @Phone,
About = @About
WHERE (ID = @Original_ID) AND
(Author = @Original_Author) AND
(CountryID = @Original_CountryID) AND
(@IsNull_Phone = 1) AND (Phone IS NULL) OR

(ID = @Original_ID) AND


(Author = @Original_Author) AND
(CountryID = @Original_CountryID) AND
)(Phone = @Original_Phone



.
..
@Author
..@Original_Author
DataSet
:
:Original Version

.
:Current Version

.

) (@Author

) (@Original_Author
..
SourceVersion DataParameter
..New

..@Author
SourceVersion :
Dim P1 As New SqlParameter("@Author",
)"SqlDbType.NVarChar, 0, "Author
:@Original_Author
Dim P2 As New SqlParameter("@Original_Author",
SqlDbType.NVarChar, 0,
ParameterDirection.Input, False, 0, 0, "Author",
)DataRowVersion.Original, Nothing

.. About Where
)nvarchar(MAX

..
..
@Original_About

:
'
'
=& DaAuthors.UpdateCommand.CommandText
"" And About = @Original_About
'
Dim P As New SqlParameter("@Original_About",
SqlDbType.NVarChar, -1,
ParameterDirection.Input, False, 0, 0, "About",
)DataRowVersion.Original, Nothing
'
)DaAuthors.UpdateCommand.Parameters.Add(P
Form1_Designer.vb
.
About
..
).nvarchar(50

..
) NULL ..(@IsNull_Phone


False

False
!
:
)(@IsNull_Phone = 1) AND (Phone IS NULL
)OR (ID = @Original_ID

.
(@IsNull_Phone True
SourceColumnNullMapping
True
New:
Dim P3 As New SqlParameter("@IsNull_Phone",
SqlDbType.Int, 0, ParameterDirection.Input,
0, 0, "Phone", DataRowVersion.Original,
)"" True, Nothing, "", "",





.
.
) ( ..

Indexed
..
" !" ..
..
)
( ..

.

.
..Timestamp
timestamp ..



..

.




!!
RowUpdated
:
e.RecordsAffected
..
.. SELECT
RecordsAffected
..

..
.
e.Row.RowError "
" ..

.
Update e.Status
..ErrorsOccurred

Continue ..SkipCurrentRow
.
..

..
DaErrAuthor
DsErr
DgErrors

.

..


:
If DaErrAuthor.Fill(DsErr, "Authors") > 0 Then
& " " = e.Row.RowError
" "
Else
& " " = e.Row.RowError
" "
End If

: ..

:
. " ":




..


..
.

.. :

! .. UserID
Users


..
User

.
. :
..



.
. " ":

..
Added
.
. " ":

..
.

..OptimisticConcurrency
OptimisticConcurrencyWithTimeStamp
RowVersion
..Timstamp
DatagridView
! ..
! .. :
DgAuthors.Columns("RowVersion").Visible = False


Select Update

..
DaTimestamp
..
:
Select * From Authors
Where ID = @ID
RowUpdated

..
Else:
If e.RecordsAffected = 0 Then
'
ElseIf e.StatementType <> StatementType.Delete Then
)"TimestampCmd.Parameters(0).Value = e.Row("ID
)"DaTimestamp.Fill(Ds, "Authors
End If

.

OptimisticConcurrency

.


Data Adapter Configuration Wizard
..
:
SqlDataAdapter .ToolBox
. Component Tray
.Configure Data Adapter
:



.Server Explorer

New Connection Add Connection
.

+ Connection String

..
.
Books.mdf
.Next

:

:
o .(Use SQL Statements) SQL
o ).(Create New Stored Procedures.
o
).(Use Existing Stored Procedures
Next
:

SQL :


.
Query Builder
SQL
..


..

Sever Explorer

.

:
SQL
;
:
;SELECT * FROM Authors
SELECT * FROM Books
Next
.


:
F4 .
SelectCommand + .
CommandText .
..
.. .

!


!
" "
Advanced Options
:

:Generate Insert, Update And Delete Statements .



..

Select .
. :Use Optimistic Concurrency
..

..
UpdateCommand
Lock
.Transaction Object
. :Refresh The DataSet
SELECT

..
Access
.
:


Select
Insert Update .Delete

..
) :
GetAuthorBooks Book
.



..
.

Next
.. Finish
Cancel .

.Previous

SqlConnection
SqlConnection1
.







DbCommandBuilder Class
Abstract Base Class
MustInherit Component Class

DataSet ..

..SELECT Command RowUpdating

SELECT
Command

) (
.
.
:
:DataAdapter
..
:
- .SELECT Command
-
Unique .
- ..
.

.. Dispose

.

:SetAllValues
True Update
.. False
..
RowUpdating

.

Concurrency Conflicts
" "
..

.
:ConflictOption
UPDATE DELETE
..Concurrency Conflicts
ConflictOption:
CompareAll

SearchableValues

.
Compare

RowVersion
..
TimeStamp .
Overwrite

Changes



.
:QuotePrefix

.

:QuoteSuffix
.
] [.
:CatalogLocation

..SQL
CatalogLocation:
Start .
End .
:CatalogSeparator

.. .
. Books.Author
:SchemaSeparator
Schema
Identifier ..
: .Person:CustomerName :
:
:RefreshSchema
..


..
CommandTimeout
Transaction
.
:GetUpdateCommand

DbCommand .
False
P1 P2
P3 ) ... ..(SET Author = @P1
.
True
) ..(SET Author = @Author

DbMetaDataColumnNames :
-
.ParameterNameMaxLength
-
.ParameterNamePattern
-
.ParameterMarkerFormat
:GetInsertCommand
DbCommand
..
.GetUpdateCommand
:GetDeleteCommand
DbCommand
.. .GetUpdateCommand

:QuoteIdentifier

) (Books.Author.ID
) ]..([Books].[Author].[ID
.
:UnquoteIdentifier

) ] ([Books].[Author].[ID
) .(Books.Author.ID
:DbCommandBuilder
.OdbcCommandBuilder Class .
.OleDbCommandBuilder Class .
.OracleCommandBuilder Class .
.SqlCommandBuilder Class .
.SqlCommandBuilder







SqlCommandBuilder Class
DbCommandBuilder

.SqlCommand
:
- .
- SqlDataAdapter
.
:
:DeriveParameters
SqlCommand


Parameters Collection ..

SQL .

.
CommandBuilder
.

:Data Mapping
Table Mapping

.. :
-
.
- .
-

.
:
- :Table Mapping

..
TableMappings .


) Table ...Table1( ..


!
..

) (Joining
) ..(Aggregation


.
Mapping ..
..
Table
.Authors-Books

- :Column Mapping

..
ColumnMappings .

:
) (
As ..

)
SELECT (.

.. Mapping
Author ""
Books " " ..
.

..:
)"Dim T = Ds.Tables("Authors-Books
)").MaxLength"(MsgBox(T.Columns


.
..
" "
..
" "

.


ITableMappingCollection Interface
IList .
:
:GetByDataSetTable
DataSet
ITableMapping
..
DataTableMapping .
:
:Item
)
( Object
.

.
:Add
Strings
) (Case-Sensitive
..
DataTableMapping
ITableMapping .
:Contains
True
.

:IndexOf

-
.
:RemoveAt

.
:


..
Remove RemoveAt !!


DataTableMappingCollection Class
ITableMappingCollection
DataTableMapping .
ITableMappingCollection
IList :
:GetTableMappingBySchemaAction


DataTableMapping ..
:
DataTableMappingCollection .
. . MissingMappingAction :
Passthrough

.
.Nothing
Ignore
Error

.InvalidOperationException
:IndexOfDataSetTable

.. -
.


ITableMapping Interface

.. :
:SourceTable
.
:DataSetTable
.
:ColumnMappings
IColumnMappingCollection
ColumnMappingCollection
.






DataTableMapping Class
DataTableMapping
.
:
- .
-
.
-
DataColumnMapping
.
:
:GetDataColumn
DataColumn
:
. Type . DataTable . MissingMappingAction ..
.
MissingSchemaAction Schema :
Add
.
AddWithKey Primary Key
.
Ignore
.
Error

.InvalidOperationException

:GetDataTableBySchemaAction
DataTable
.. :
.DataSet MissingSchemaAction .
:GetColumnMappingBySchemaAction
DataColumnMapping
:
. MissingMappingAction .







IColumnMappingCollection Interface
IList :
:GetByDataSetColumn

IColumnMapping
..
DataColumnMapping.
:
:Item
)
(Case-Sensitive Object
.
:Add
Strings
..
DataColumnMapping

IColumnMapping .
:Contains
)
( True .

:IndexOf

-
.
:RemoveAt

.







DataColumnMappingCollection Class
IColumnMappingCollection
DataColumnMapping
.

IColumnMappingCollection :
:GetDataColumn
GetDataColumn DataTableMapping
Shared

DataColumnMappingCollection .
:GetColumnMappingBySchemaAction
GetColumnMappingBySchemaAction
DataTableMapping
Shared
DataColumnMappingCollection
.
:IndexOfDataSetColumn

-
.


IColumnMapping Interface

:SourceColumn
.

:DataSetColumn
.







DataColumnMapping Class
IColumnMapping ICloneable
.
:
- .
-
.
:
:GetDataColumnBySchemaAction
DataColumn :
DataTable .. DataSetColumn
.
Type . MissingSchemaAction .
Shared

.
Mapping
:
(Dim TM = DaAuthors.TableMappings.Add
)""Table", "Authors-Books
)"" TM.ColumnMappings.Add("Author",
)"" TM.ColumnMappings.Add("Book",

Provider Factories

:
OleDbConnection SqlConnection .OracleConnection
OleDbCommand SqlCommand


.OracleCommand
OleDbDataReader SqlDataReader .OracleDataReader
OleDbDataAdapter SqlDataAdapter .OracleDataAdapter

!
:
- System.Data.Common:
DbConnection . DbCommand . DbDataReader . DbDataAdapter .
)
Abstract Base Classes Polymorphism
" : "(.
- DbProviderFactories DbProviderFactory
System.Data.Common

.


.

DbProviderFactories Class
DbProviderFactory
:
:GetFactoryClasses
DataTable
..
.. :
Name
.
Description
.
InvariantName
.
Assembly

QualifiedName
.
DataProviders
.
:GetFactory
DbProviderFactory
.. :
- .InvariantName
- DataRow
..
.GetFactoryClasses
.DbProviderFactory

DbProviderFactory Class

.
:

:CanCreateDataSourceEnumerator
True
DbDataSourceEnumerator ..
.
:
:CreateConnectionStringBuilder
DbConnectionStringBuilder

.
:CreateConnection
DbConnection
.

ConnectionString
.
:CreateCommand
DbCommand
..

.ExecuteReader

CreateConnection
CreateCommand Factories
:
Dim Command = Fac.CreateCommand
Command.Connection = Cn
CreateCommand

:

Dim Command = Cn.CreateCommand


:CreateParameter
DbParameter
.
CreateParameter
.
:CreateDataAdapter
DbDataAdapter
..
GetTable Factories
:
Dim Table As New DataTable
Dim Da = Fac.CreateDataAdapter
Da.SelectCommand = Cmd
)Da.Fill(Table
:CreateCommandBuilder
DbCommandBuilder
.
:CreateDataSourceEnumerator

DbDataSourceEnumerator
..

Nothing
!
CanCreateDataSourceEnumerator
.
:CreatePermission
CodeAccessPermission

... DBDataPermission
CodeAccessPermission
..SqlClientPermission
.
:DbProviderFactory
.OdbcFactory Class -
.OleDbFactory Class -
.OracleClientFactory Class -
.SqlClientFactory Class -

:
.

DbTasks ..
MyDbConnector
..
..
Factories





DbTasks
Radio Buttons

!

MyDbConnector Providers
New
.
GetProviderName Providers

DbProviderFactories.GetFactor
..

.

MyDbConnector



!

CheckedChanged :
If RdSql.Checked Then
(DbBooks = New MyDbConnector
My.Settings.BooksMdfConStr,
)MyDbConnector.Providers.SqlServer
Else
(DbBooks = New MyDbConnector
My.Settings.BooksMdbConStr,
)MyDbConnector.Providers.OleDb
End If
DbBooks
MyDbConnector .
" "
AccessStoredProcedure
GetAuthorBooks .
:N-Tiers

Layers ..
.. MyDbConnector


..


..
Multi-Tier
Applications

n-Tier
Applications

Distributed Applications ..
:
- :Data Tier


.. ..
.
- :Data Access Tier

.. MyDbConnector


LinQ-To-SQL .


.
- :Data Display Tier

.

.


DbDataSourceEnumerator Class

SqlDataSourceEnumerator
Local .Remote

.
:
:GetDataSources
DataTable
.. :
ServerName
.
InstanceName ..
.
True Cluster
IsClustered
.
Version
.

.. :
-
.
-
!
-

.
DataProviders

:

RowEnter
DataRow

DbProviderFactories.GetFactory
:
)Dim R = TblProviders.Rows(e.RowIndex
)Dim Pf = DbProviderFactories.GetFactory(R
CanCreateDataSourceEnumerator

CreateDataSourceEnumerator

GetDataSources :

If Pf.CanCreateDataSourceEnumerator Then
Dim Se = Pf.CreateDataSourceEnumerator
Dim TblServers = Se.GetDataSources
DgServers.DataSource = TblServers
Else
DgServers.DataSource = Nothing
End If

Local Server
) (
SQLEXPRESS !


SqlDataSourceEnumerator Class
System.Data.Sql
.DbDataSourceEnumerator

.
:
:Instance
SqlDataSourceEnumerator
.
SqlServers

:
= DgServers.DataSource
SqlDataSourceEnumerator.Instance.GetDataSources

DataSet


) (

.


..

.
XML
Schema ..
XML
.
:
- Original Version .
- Current Version
.
RowState
..

..
:

-
..
.
-
..
.
-

.
:
-

SELECT
.
.
-


..Concurrency Violations
.
.






DataSet Class
System.Data
IListSource .
:
- .
-
.XML
:
:DataSetName
Document
Element XML .
:Namespace
.XML
:Prefix

.. XML
.
:
ReadXml ReadXmlSchema
XML
DataSetName
Prefix
.
DataSetSample ..
:
"Ds.Namespace = "My Project
"Ds.Prefix = "Authors-Books

"Ds.DataSetName = "DsBooks
" "

.C:\DsBooksSchema.xml
:CaseSensitive
True
Filtering ..
DataTable.Select ..DataColumn.Expression
.False

CaseSensitive .
:Locale
CultureInfo

.
Local
.
:EnforceConstraints
) True (

.
:HasErrors
True
.. HasErrors
.

:Tables
DataTableCollection
DataTable Objects ..
.

..
Table Collection Editor
:

Add

..
.

:Relations
DataRelationCollection
DataRelation Objects
.. .

..Relations

..
..

Relations Collection Editor :

Add ..
..
OK
..
Edit .

:DefaultViewManager
DataViewManager Object
..
.
:ExtendedProperties
PropertyCollection
.
PropertyCollection Hashtable
Key
.Value

:
)"Ds.ExtendedProperties.Add("ProgName", "MyProg
))"MsgBox(Ds.ExtendedProperties("ProgName
:RemotingFormat

Remoting
SerializationFormat:
Xml
Binary

..XML
.
..Binary
.

RemotingFormat
.
:SchemaSerializationMode

..Typed DataSet :Serialization

..

..Remoting Serialization

Remoting
.
:SchemaSerializationMode
IncludeSchema ..
.
ExcludeSchema


..

) .(Un-typed DataSet
.
:
:Clear

..
XML
.XmlDataDocument
:Reset

.
:Clone
) (
.. .

:Copy
)
( .
:GetChanges


..AcceptChanges Nothing
.



.
DataRowState

.. :

Detached Rows
.


Unchanged .AcceptChanges

Added
.

Deleted
.

Modified .
.OR

:HasChanges
True
.
FormClosing

..CustomDataSet
" " DataSetSample
.
DataRowState
.. True
..

:
))MsgBox(Ds.HasChanges(DataRowState.Added
:AcceptChanges
AcceptChanges
.
:RejectChanges
RejectChanges
.
:CreateDataReader
DataTableReader
.
Result Set
DataSet.Tables

..
NextResult
.

DataTable Array


.
" "
.Output Window
:Load
DataReader
.. :
- :
IDataReader . LoadOption
Original Version
..Current Version
.
DataTable Array DataSet.Tables

ResultSet
.
-
.
- ..

Delegate FillErrorEventHandler
FillError ..


.

:Merge
..

..

.
:
-
DataSet DataTable
.DataRow Array
- True

...
:
..
..
True
..
False
..
:



) (True

) (False

True

DataRow.Item
!


Merge

OptimisticConcurrency:

" " True



.
" " False

) (.
-
)
(
MissingSchemaAction
..
Add

.
Constrains ..
:
.ConstraintException False DataSet.EnforceConstraints
.
RowError
True
EnforceConstraints .

:InferXmlSchema
XML
..
:
XML Stream
TextReader " .XmlReader "XML
Url .
:GetXmlSchema
XML
.
:GetXml
XML
.
:WriteXmlSchema
XML

Stream TextReader " "XML
.XmlReader

) Converter(Of Type, String
Type ..String


.
:WriteXml

..XML
XmlWriteMode :
IgnoreSchema ..
.

WriteSchema .
DiffGram

Original Version
Current Version
.
" "
DataSetSample WriteSchema
..
.
:

DataSet.GetChanges
WriteXml
.
:ReadXmlSchema
WriteXmlSchema
XML ..

DataSet.Reset

.ReadXmlSchema
:ReadXml
XML
..
XmlReadMode :

Auto
Read
Schema

Ignore
Schema
Infer
Schema

Infer
Typed
Schema
Diff
Gram

.
)
WriteXml
WriteSchema
( ..


.

!
.


..

.

.String


..DiffGram

.
Fragment
XML .
" "
DataSetSample ReadSchema
..
.
ReadXml AcceptChanges
DataAdapter.Fill
Addedd

! ..

AcceptChanges

.

XML .

..
CustomDataSet .dsf
) (DataSet Format

XML

.
:
:MergeFailed
..Merge

.
e MergeFailedEventArgs
:
Table DataTable
.
Conflict
.


Generate DataSet Wezard
..
Data Adapter

" " ..Generate Dataset
Data .
" " :




..DataSet1


.




.

.
Ok .. :
DataSet1.xsd ..Solution Explorer xsd
" " Xml Schema Definition
Notepad
XML
) ( ..

Schema Designer
:

DataSet1 DataSet ..Class DataSet1.Designer.vb


DataSet1.xsd

Show All Files .


DataSet1
Typed DataSet .
DataSet11 ..Component Tray
DataSet1 :
Friend WithEvents DataSet11 As DataSet1
DataSet11
..dataSet1
DsAuthorBooks
DsAuthorBooks1 .DataSet11

DataSet1 Toolbox :
ProjectName Components
ProjectName .
.
TypedDataSet .
.. Data
) Preview Data
( ..
:



..

.Preview

:Typed DataSet
DataSet1
..DataSet1.xsd
Typed DataSet
..
..
DataSet1.Designer.vb TypedDataSet
DataSet1 :
- ..
XRow X .
DataRow

.. DataSet1
AuthorsRow
Author : Book
.
- ..
XDataTable X .
) TypedTableBase(Of T
DataTable T .
DataSet1 AuthorsDataTable
).TypedTableBase(Of AuthorsRow

..DataColumn Class
AuthorsDataTable AuthorColumn
BookColumn .

DataTable:
.XRowChanging .XRowChanged .XRowDeleting .XRowDeleted X .. :
AuthorsRowChanged AuthorsRowChanging :

.AuthorsRowDeleted AuthorsRowDeleting

- DataSet1
..
DataSet1 Authors
AuthorsDataTable .
..

:
)"DataSet11.Tables("Authors").Rows(2).Item("Author
.. :
DataSet11.Authors(2).Author

DataSet Class
DataSet1 ..
:
- .
- .. ) (
Authors Author

.. ) (
DataSet1
.
-



..

IntilliSense .
.

.
DataSetContents
:

:
XML
.. :
. Project .Add Existing Item DataSetContents ..DsAuthorsBooks.xsd .
.. ..Typed DataSet
X.DsAuthorsBooks X ..
.OK
DsAuthorsBooks1 .. .Ds
..EditIin DataSet Designer XML
.

:Custom DataSet

.. XML
DataGridView
XML .
CustomDataSet Project
Add New Item ..
Data DataSet
MyDataSet .OK
XML ..MyDataSet.xsd
.
XML
..DataSet DataTable
..
..DataTable1
Students
..Enter .

Add ..Column
..ID F4
DataType ..Int32
.. : AutoIncrement
True
AutoIncrementSeed AutoIncrementStep .
ID
Set Primary Key .
..Name
String ..
Unique True
.. MaxLength
.
Name
..Insert Column
.Delete

Subjects ID :
..Name Students Copy
Paste
Students1 ..Subjects
.
Grades StudentID
SubjectID Grade .Int16
Grades ..
Many-to-Many
.. .
StudentID SubjectID
..
) Ctrl (
Add ..Key
Unique Constraint :


) StudentID
SubjectID ( ..

Primary Key .. .. OK
.
.. Relation
..

..

..
..
.
Students.ID Grades.StudentID
Subjects.ID ..Grades.SubjectID
:
Both Relation And Foreign Key Constraint
Choose what to create :
..Cascade
.
:

..
..DataSet

..MyDataSet OK
MyDataSet1
.. .DsStudents

..
.CustomDataSet
XML

.
Calculated Column ..Grades
Grades

..Insert Column Subject


Expression :
Parent(Subjects_Grades).Name
ReadOnly True

..
Subjects_Grades
Subject
) (SubjectID
.. .



.
ListBox ..
.
:

...

..
.
..
Subject
..
.. !
DataSet.Copy
Subject
..
..
Subject
..
" ".

..

..
DataCoulmn
..
" ."

:
CustomDataSet ..
..Self-Relation
SaveTreeNodes

TreeViewSample
.. SaveTreeNodes .
..

..XML

.
SaveTreeNodes
TreeDataSet
TreeNodes :


Int16
ID
.
Text
String .

Int16
ParentID
.
ID .ParentID
.. :

..TreeDs

..XML
:
) (TreeDs.Clear
For Each Node As TreeNode In TreeView1.Nodes
(Dim R = TreeDs.TreeNodes.AddTreeNodesRow
)Node.Text, Nothing
)SaveChildren(Node, R
Next
)"TreeDs.WriteXml("C:\TreeNodes.Xml

TreeNodes ..
AddTreeNodesRow
.. :
Text . TreeDataSet.TreeNodesRow ..
ParentID
..
Nothing ..
ParentID.
..
SaveChildren :
TreeNode .
TreeDataSet.TreeNodesRow .
Recursive

:

Sub SaveChildren(ByVal ParentNode As TreeNode,


)ByVal ParentRow As TreeDataSet.TreeNodesRow
For Each Node As TreeNode In ParentNode.Nodes
(Dim R = TreeDs.TreeNodes.AddTreeNodesRow
)Node.Text, ParentRow
)SaveChildren(Node, R
Next
End Sub

WriteXML
.
..
..
:ReadXML
) (TreeDs.Clear
) (TreeView1.Nodes.Clear
)"TreeDs.ReadXml("C:\TreeNodes.Xml
..
..
ParentID ..DbNull
IsParentIDNull

Text
LoadChildren ..
:
For Each R In TreeDs.TreeNodes
If R.IsParentIDNull Then
)Dim Node = TreeView1.Nodes.Add(R.Text
)LoadChildren(Node, R
End If
Next
LoadChildren Recursive
.



GetChildRows ..
:
Sub LoadChildren(ByVal ParentNode As TreeNode,
)ByVal ParentRow As TreeDataSet.TreeNodesRow
For Each R As TreeDataSet.TreeNodesRow In
)"ParentRow.GetChildRows("Self_Relation
)Dim Node = ParentNode.Nodes.Add(R.Text
)LoadChildren(Node, R
Next
End Sub
..
.
..






TableAdapter Class

Typed DataSet Designer
.
TableAdapter DataAdapter

..
SELECT

.. .

.. :
.TableAdapter Project .Add New Item Data DataSet .DsAuthorsBooks.xsd
TableAdapter ..
:
TableAdapter Configuration wizard.
.. Books.mdf
.Next
..
BooksConnectionString .Next
.. Use SQL Statement .Next
:SELECT * FROM Authors
.Next
:


Fill .
DataTable

GetData .

.. Update
Insert .Delete
.Next
.. Finish .

..
Authors


.AuthorsTableAdapter


Properties
.. :
:Name
.
:Modifier
.. Public
.
:Base Class
..
..System.ComponentModel.Component

..Component
!
:Connection
..
) (New Connection .
:ConnectionModifier
..
Friend .
:SelectCommand
..


.
:UpdateCommand
.
:InsertCommand

.
:DeleteCommand
.
:GenerateDbDirectMethods
True
Update Insert Delete
.. False

.DeleteCommand InsertCommand UpdateCommand
..
.. :



..DsAuthorsBooks.Designer.vb

Namespace
XTableAdapters X ..
:
Partial Public Class DsAuthorsBooks
Inherits Global.System.Data.DataSet
'

End Class
Namespace DsAuthorsBooksTableAdapters
Partial Public Class AuthorsTableAdapter
Inherits Global.System.ComponentModel.Component
'
End Class
Partial Public Class BooksTableAdapter
Inherits Global.System.ComponentModel.Component
'
End Class
Partial Public Class TableAdapterManager
Inherits Global.System.ComponentModel.Component
'
End Class
End Namespace
:

:Connection

..
.SqlConnection
Private
Sub
InitConnection .
:Transaction

..
.SqlTransaction
:ClearBeforeFill
) True (
..
False
.
:

Protected Property
Adapter

..
Private Sub InitAdapter
.

CommandCollection

.
Private
Sub
InitCommandCollection
.
:

:Fill

..

DsAuthorsBooks.AuthorsDataTable

.DsAuthorsBooks.BooksDataTable


.
:GetData
..
AuthorsDataTable
BooksDataTable .
:Update
..
Update ..
:
- .
-

.. :
:
)"Return Me.Adapter.Update(dataSet, "Authors
- DataRow
.
-
.
- ..

..
About Phone CountryID Author :
.Original_RowVersion Original_ID

-
) ID (.


.Concurrency Violation
:Insert
..
.


.
:Delete
..
Original_ID Original_RowVersion ..


.


.Concurrency Violation

:

..
:
-
..
.
- ..Scalar Value
.

..Add Query
TableAdapter
..Query Configuration Wizard
:
) SQL ( .. Use SQL Statement .Next
- :

:
. :
SELECT statement witch returns rows.
. :

SELECT statement witch returns a single value.


. .UPDATE
. .DELETE
. .INSERT
.Next
:*SELECT Books.
FROM Books INNER JOIN Authors
ON Books.AuthorID = Authors.ID
AND Author = @Author
.Next
.. :
FillBy . FillByAuthor

.
GetDataBy . GetDataByAuthor

.
Next Finish .



..

..
.

..


..Configure
.Finish
.Delete

..
..
Query ..
:
SELECT Statement that returns a single value
:
SELECT COUNT(BOOK) FROM Authors, Books
WHERE AuthorID = Authors.ID AND Author = @Author
..Next ..
..ScalarQuery
GetAuthorBooksCount ..Finish


.

:
) Phone
( FillBy
) Nullable : FillByPhone
? ..(String Nothing
.

:

:
Existing Stored Procedure
..Next
.. ..GetAuthorBooks
:

:

Next
.. :
Tabular Value .
Single Value .
No Value .
..Next .

:Global Queries


..
Add ..Query
Query
..

..
..

QueriesTableAdapter ..
.
GetAuthorsCount
GetBooksCount .


..

!

:


Preview Data ..
.Data



Preview .

TableAdapterManager


Hierarchical Update

.
..

Properties
Hierarchical Update .False
:
:Connection
.
:XTableAdapter ...
X
..
..
AuthorsTableAdapter .BooksTableAdapter
Nothing
.
:TableAdapterInstanceCount
.Nothing

:BackUpDataSetBeforeUpdate
True
..
..
Rollback


..

.False
:UpdateOrder

UpdateOrderOption:
..
InsertUpdateDelete
.
UpdateInsertDelete .
:
:UpdateAll

..
..DsAuthorsBooks
UpdateOrder
Rollback

.

:

..
DataTable
.
X.Designer.vb
) X (

!
Partial
..

View Code ..
) X.vb
..(DsAuthorsBooks.vb
.DsAuthorsBooks.xsd


..
Private Public

Protected .Private
:
. XRowChanging X ..
AuthorsRowDeleting TableAdapter
.
ColumnChanging
..
TableAdapter .
- .

:
..:
_ Dim TaAuhtors As New
DsAuthorsBooksTableAdapters.AuthorsTableAdapter
))" "(MsgBox(TaAuhtors.GetAuthorBooksCount

:
_ Dim TaBooks As New
DsAuthorsBooksTableAdapters.BooksTableAdapter
_ Dim TaM As New
DsAuthorsBooksTableAdapters.TableAdapterManager
TaM.AuthorsTableAdapter = TaAuhtors
TaM.BooksTableAdapter = TaBooks

:
-

X.DsAuthorsBooks
X ) TableAdapter
(.
-

X Components X ..
..
TableAdapter :
. .DsAuthorsBooks
. .AuthorsTableAdapter
. .BooksTableAdapter
. .QueriesTableAdapter
. .TableAdapterManger

..
TaBooks TaAuthors Ds :
.TaM TaQueries

- TaM
Properties
..
AuthorsTableAdapter TaAuthors
BoosTableAdapter ..TaBooks
.
-
Add Query
..
FillBy GetDataBy
:

) (FillByPublisher
..
Existing Query Name
..
.
Ok ..
FillByPublisher .
GetDataByPublisher
:
Edit Query In DataSet
.
FillByPublisher Configure
.
Next Return a DataTable
GetDataByPublisher .Finish
ToolStrip
) Publisher (

FillByPublisher

..
:

TableAdapter
" "
.







DataSet:
DataTable DataRow .DataCoulmn
.DataRelation Constraints. .


InternalDataCollectionBase Class
ICollection
.
:
DataTableCollection Class .
DataColumnCollection Class .
DataRowCollection Class .
DataRelationCollection Class .
ConstraintCollection Class .

DataTableCollection Class
InternalDataCollectionBase
..DataTable
.DataSet.Tables
:Ds
For Each Tbl As DataTable In Ds.Tables
)MsgBox(tbl.TableName
Next

ICollection :
:Item
DataTable
.. :
- .
- .
-
Name Space
.
Nothing .
:Add
:
-
) Table1 Table2 (... .
-
.. ""
Table1 Table2 ...

.
-
..

..
..:
)"Ds.Tables.Add("MyTable", "Db1
)"Ds.Tables.Add("MyTable", "Db2
- DataTable
.
DataTable

.
:CanRemove
True DataTable
.. False
.. False
:
)))"MsgBox(Ds.Tables.CanRemove(Ds.Tables("Authors
:Remove
Add
..

..


..
..
CanRemove ..:
)"Dim T = Ds.Tables("Authors
If Ds.Tables.CanRemove(T) Then
)Ds.Tables.Remove(T
End If
:Contains
True ..
.Add

:IndexOf

- Add
.
:
:CollectionChanging

.. e
CollectionChangeEventArgs :
Action CollectionChangeAction
..
:
:Add . :Remove . :Refresh Clear .
Element Object
.. Nothing
Action .Refresh
:CollectionChanged
.. e
CollectionChangeEventArgs
.

DataTable Class

IListSource MarshalByValueComponent

..

Un-typed DataSet Tables
..

Typed DataSet XML


.
:
- .
- .
-
.
- SerializationInfo

StreamingContext
..Serialization .

:
)Dim T As DataTable = Ds.Tables(0
:
)"Dim T As New DataTable("MyTable
)Ds.Tables.Add(T
:
:TableName
.
:Namespace
..
.
:Prefix
.
:DataSet

DataSet ..
Nothing .
:RemotingFormat

Remoting
SerializationFormat .
:CaseSensitive
True
) Small (Capital .
:Locale
CultureInfo
.
:MinimumCapacity
..
..


.

:Columns
DataColumnCollection
.. .
:Rows
DataRowCollection ..
.
:ParentRelations
DataRelationCollection
)
..(Master Table DataRelationCollection
.
:ChildRelations
DataRelationCollection
)
.(Details Table
:PrimaryKey
DataColumn Array
..


.. :



..
.

:Constraints
ConstraintCollection ..
.
:DefaultView
DataView Object

.. DataView Class
.
:DisplayExpression

.DataGridView
:HasErrors
True .
:ExtendedProperties
PropertyCollection
..
Password " "
":"
)"Dim T As DataTable = Ds.Tables("Books
Dim EP As PropertyCollection = T. ExtendedProperties
)" " EP.Add ("Password",
"EP.Item("Password") = "
))"MsgBox(EP("Password
:

:Clone
DataTable
Schema ..
.
:Copy
DataTable
.
:Clear
.
:Reset
.
:NewRow
)
( DataRow
Rows
..:
)"Dim T As DataTable = Ds.Tables("Authors
Dim R = T.NewRow
" " = )"R("Author
" " = )"R("About
R("CountryID") = 21
)T.Rows.Add(R
:ImportRow
DaraRow
Original Version
Current Version .

:LoadDataRow
..
:
Object Array ..

..

..
.


AutoIncrement
..True
..
.
Boolean True AcceptChanges
..
False
Added .Modified
DataRow
.
:
Typed DataSet Class
..

AuthorsDataTable AuthorsRow
:

:NewAuthorsRow
AuthorsRow
..:
Dim R = Ds.Authors.NewAuthorsRow
" " = R.Author
" " = R.About
R.CountryID = 21
)Ds.Authors.AddAuthorsRow(R
:AddAuthorsRow
AuthorsRow

.

.. :
", 21, "", "(Ds.Authors.AddAuthorsRow
)", Nothing "

Nothing ..
) (ID
.
:RemoveAuthorsRow
AuthorsRow
.
:Select
DataRow Array
.. :
-
.
-

WHERE ..SQL


:
)" '' < Dim R( ) As DataRow = T.Select ("Book

DataRow.Expression
.
-
.. :
- ) (Book

) .(Copies_No * Price
- :
:ASC .
:DESC .
:
)"' ", "Book DESC' < Dim R = T.Select ("Book
-
DataViewRowState
..
... ..
DataViewRowState .
:Compute

Aggregate Function
.. Object
.. :
..
Compute:
)" '' < C = TblBooks.Compute("Count(Book)", "Book

..
:

)"" C = TblBooks.Compute("Sum(Copies_No)",

..
:
)"" C = TblBooks.Compute("Sum(Copies_No * Price)",

" " Expression
..

.DataCoulmn

CustomDataSet
"" ..
" "
..
:
(SumCell.Value = DsStudents.Grades.Compute
))"SUM(Grade)", "StudentID = " & Trim(StdId
StdId .
:GetChanges
DataTable

.AcceptChanges

DataRowState
.

:GetErrors
DataRow Array

.
:AcceptChanges
AcceptChanges .
:RejectChanges
RejectChanges .
:BeginLoadData
:
Notifications ADO.NET .. Events
.
.Indexes .Constraints


.
:EndLoadData
BeginLoadData


.
:Merge


.

DataSet.Merge
DataTable
.DataSet
:CreateDataReader
DataTableReader
..
DataTableReader .
:WriteXmlSchema
XML

Stream TextWriter .XmlWriter

True
.
:WriteXml
XML

Stream TextWriter .XmlWriter
True
.
XmlWriteMode
.
:ReadXmlSchema


Stream TextWriter ..XmlWriter
.

:ReadXml


Stream TextWriter ..XmlWriter
.
:
:ColumnChanged
.. e
DataColumnChangeEventArgs
:
DataColumn
Column
.
DataRow
Row
.
ProposedValue ) (..

.
:ColumnChanging

) ( ..
:
)e.ProposedValue = e.Row(e.Column

..

..

:TableAdapter

If e.Column Is AuthorColumn AndAlso


e.ProposedValue = "" Then
)e.ProposedValue = e.Row(e.Column
End If

.
:RowChanged
.. e
DataRowChangeEventArgs
:
Row DataRow
.
Action
DataRowAction:
:Add . :Delete . :Change . :ChangeOriginal Original Version .
:ChangeCurrentAndOriginal Original Version
Current Version .
:Commit Transactions
.
:Rollback .
:Nothing . :RowChanging

) (.

:TableNewRow
NewRow
.. e
DataTableNewRowEventArgs Row
DataRow ..
.
:RowDeleted
.. e
DataRowChangeEventArgs .

DELETED
!!
:RowDeleting

) ( ..

e.Cancel !

.

) DataTable.Rows.Remove(e.Row
!
..
:
..

.

..
TableAdapter
AuthorsRowDeleting RowDeleting

Merge
:
TempTable = New AuthorsDataTable
)TempTable.Merge(Me
RowDeleted

:
If TempTable IsNot Nothing AndAlso
TempTable.Count > 0 Then
)Me.Merge(TempTable
)(TempTable.Clear
End If
TempTable.Count > 0
..
!
Count
:
If TempTable.Rows.Count > 0 Then



! .. Merge
..
Merge

:
TempDs = New DsAuthorsBooks
)}TempDs.Merge({e.Row

:
TempDs
.. :
Dim TempDs As New DsAuthorsBooks

Stack ..
DsAuthorsBooks

TempDs
TempDs
!

.
:New
Dim TempDs As DsAuthorsBooks
:RowDeleting
TempDs = New DsAuthorsBooks
..
:
) (e.Row.RejectChanges

Cancel
RejectChanges
!! ..
:
))MsgBox(Me.Rows.IndexOf(e.Row

!
:
) (Me.RejectChanges


!


.

e.Cancel !
:TableCleared
Clear
..Clear
.
e DataTableClearEventArgs
:
DataTable
Table
.
TableName
.
TableNamespace .
:TableClearing

) Clear ( ..
.






DataRowCollection Class
InternalDataCollectionBase
.DataRow Class
:
:Add
:
- DataRow .
- Object Array
..
DataTable



.

DataRow
.
:Contains
True
Primary Key .. :
- Object
.
- Objects

.

:Find
DataRow
Nothing
.

..
Fill
FillSchema
.
:InsertAt
DataRow
.






DataRow Class
Public
Constructor
DataTable.NewRow ..
NewRow
..
:
)"Dim TblBooks = Ds.Tables("Books
) (Dim BooksRow As DataRow = TblBooks.NewRow
)TblBooks.Rows.Add(BooksRow
:
:Table
DataTable ..
NewRow

Rows
.
:Item

.. Object
.. :
-
DataColumn ..
)
(:
)Dim R = Ds.Tables("Authors").Rows.Item(2
)"Dim X = R.Item("Author
:

)Dim R = Ds.Tables("Authors").Rows(2
)"Dim X = R("Author
:
)"Dim X = Ds.Tables("Authors").Rows(2)("Author
Rows
Rows.Item
Row.Item .

:
)"Dim X = Ds.Authors(2)("Author
:
Dim X = Ds.Authors(2).Author
- DataRowVersion
..
..
DataRowVersion :
Original
.Original Version
Current
.Current Version
Proposed ..


.Current Version
Default :
.Original Version
.Current Version
Detached
.Proposed

.Default

:
'
))MsgBox(Row(0, DataRowVersion.Original
'
))MsgBox(Row("Book", DataRowVersion.Current
'
))"MsgBox(Row("Book
:ItemArray
Object Array
..
..:
)"Dim TblAuthors = Ds.Tables("Authors
) (Dim R = TblAuthors.NewRow
", 5, "", " R.ItemArray = {Nothing,
}", Nothing "
)TblAuthors.Rows.Add(R
:HasErrors
True ..
RowError
GetColumnsInError
!
:RowError
..
HasErrors True
.

:RowState
DataRowState
.. .
:
:HasVersion
True
DataRowVersion
.

:
If Row.HasVersion(DataRowVersion.Proposed) Then
))MsgBox(Row(0, DataRowVersion.Proposed
End If
:SetAdded
RowState ..Addded
..
AcceptChanges.
:SetModified
RowState ..Modified
..
AcceptChanges.
:AcceptChanges


..AcceptChanges

.. :
Unchanged RowState .
.Deleted

Current Version Original Version.



.

!
:RejectChanges


..AcceptChanges
:
Unchanged RowState .
.Added
Original Version Current Version.
..
.
:BeginEdit



.

Data-bound Controls
.DataGridView

.Proposed Version
:CancelEdit
Begin Edit
Proposed Version

Current Version ..
.
:EndEdit
Begin Edit

Proposed Version
..Current Version
.
.AcceptChanges
:GetColumnError
..

DataColumn .
:SetColumnError

.. :
DataColumn
.
. RowError
..
SetColumnError True HasErrors

..
.RowError
:GetColumnsInError
DataColumn Array
.
:ClearErrors

..
RowError GetColumnError
.
:Delete
Deleted RowState ..

RejectChanges .AcceptChanges
Delete
) (RowState = Added .
:GetChildRows
DataRow Array
.. :
. DataRelation
..

Countries .
.
ChildRelations
.
.
DataRowVersion
Version
.
:SetParentRow
DataRow
Master ..
) (
) .(Self Relation

DataRelation .

..

ID
AuthorID.
:GetParentRow
..
:
.

.DataRelation
.
DataRowVersion Version
.
:GetParentRows

DataRow Array
..
GetParentRow
!
:IsNull
True
..DbNull :
-
DataCoulmn .
- DataRowVersion
Version .

DataColumnCollection Class
InternalDataCollectionBase
.DataColumn Class

:

:Item
DataColumn
.. :
-
..
.
-

Nothing .
:Add


..Update
SQL
.
:
-
) Column1 ... Column2 ( ..
.String
- DataColumn
.
-
..
) Column1 ... Column2(.
-
Type ..
String .
-
Expression

..Calculated Column
.DataColumn

DataColumn

.

..
) (
Un-Typed DataSet

Tables

..Columns
:

Add
.
:IndexOf

- ..
:
- .

- .DataColumn
:CanRemove
True DataColumn
.. False
.
:Remove
..
:
- .
- .DataColumn
:
:CollectionChanged
.
e CollectionChangeEventArgs
.DataTableCollection

DataColumn Class

MarshalByValueComponent
.
Add
DataColumnCollection ..
:
. Type Object . Expression .
MappingType ColumnMapping .
Temp
:Ds
))Dim Clmn As New DataColumn("Temp", GetType(String
)Ds.Tables("Books").Columns.Add(Clmn
:
:Table
DataTable .
:ColumnName
.
:Namespace
.
:Prefix
.
:Ordinal
.

:Caption
..
Data-Bound Controls
! ..
.
:DataType
Type Object .
:DefaultValue
..
.
:AllowDBNull
True
.DbNull
:MaxLength

.. -
..
.
:ReadOnly
True
..
True
Expression

.
:Unique
True .

:AutoIncrement
True
..
ReadOnly ..
.False
:AutoIncrementSeed
.. .
:AutoIncrementStep
.. .
:ExtendedProperties
PropertyCollection
.
:ColumnMapping
XML
MappingType:
Element

Attribute

..XML
ID Author :
><Authors
><ID>1</ID
' = ><Author
></Authors
..XML
:ID
>' ' = <Authors ID=1 Author
>'/' = <Book ID=1 Book
></Authors

SimpleContent ..XmlText
.
Hidden


.
:DateTimeMode

.. DataSetDateTime:
Local

.
Utc
.
Unspecified
.
UnspecifiedLocal ..
.

: Unspecified
UnspecifiedLocal .
:Expression
:

.Calculated Column
DataTable.Select
.

:

:
+ : - : * /
..%:
"Col.Expression = "Price * Copies_No
:
AND, OR, NOT

:
= Col.Expression
"' And AuthorID = 4' < "Book
True
False Select

..
..Col
:
Dim R( ) As DataRow
)"R = T.Select ("Col = True
:
= <> > < >= <= IN LIKE
SQL
)* (%

..LIKE :
" '*' "Author Like

..:
" '*' "Author Like
" '*' "Author Like

CONVERT ..:
= Col.Expression
")'"Convert(ID, 'System.Int32
LEN
..
Col
:Book
")Col.Expression = "Len(Book

) ( ..
:
")Col.Expression = "Len(Book + Author
"&"
..
"."+
ISNULL
:
..

..
AuthorID - :
")Col.Expression = "IsNull(AuthorID, -1
TRIM

..:
")Col.Expression = "TRIM(AuthorID
SUBSTRING

..
) ..(String.SubString:
= Col.Expression
")"SUBSTRING(Book, 2, 8
IIF
:
. . .= Col.Expression
:
")'' ',' "IIF(LEN(Price)>10),

Parent


.. Col
..
:
")Col.Expression = "LEN(Parent.Author

Child



Parent:
= Col.Expression
")"LEN(Parent(AuthorsBooks).Author

Primary Key

..


.

:
(Dim Col As New DataColumn
))"NoOfBooks", GetType(Integer
")Col.Expression = "Count(Child.AuthorID
)Ds.Tables("Authors").Columns.Add(Col


Child:
= Col.Expression
")"Count(Child(AuthorsBooks).AuthorID

:
Sum, Avg, Min, Max, Count, StDev, Var


..Grouping :
") "Count (AuthorID
..

\r
\n
\t

Child
..
"Count (Child.AuthorID)" :

.
.
.
.Tab

' ' :
''
''1/1/2009
# #:
#1/1/2009#
:
:SetOrdinal

..
..Insert
" " CustomDataSet



Subject

) ( ..
! ..

..
:ShowGrades
GradesCols(2).DisplayIndex = 0

.

DataTableReader Class

DbDataReader Class

.

CreateDataReader :
Dim Tr = Ds.Tables("Authors").CreateDataReader
Do While Tr.Read
))"MsgBox(Tr("ID
))"MsgBox(Tr("Author
Loop

CreateDataReader DataSet:
Dim Tr = Ds.CreateDataReader
Do
Do While Tr.Read
"" = Dim RowTxt As String
For I = 0 To Tr.FieldCount - 1
RowTxt &= Tr.GetName(I) + " = " +
Tr(I).ToString( ) + vbCrLf
Next
)MsgBox(RowTxt
Loop
Loop While Tr.NextResult
NextResult
..

.. FieldCount
.
.DataTableReaderSample
DataTableReader :
- DataTable .
- DataTable Array .
.


DataRelationCollection Class

InternalDataCollectionBase
.DataRelation Class
Collections
DataRelation
.. :
:Item

DataRelation ..
DataSetContents

.
:Add
:
- DataRelation .
- DataColumn

.
-
DataColumn
.
- :
.

-
False ..
True
UniqueConstraint
ForeignKeyConstraint
.
-
DataColumn Array
.
DataRelation
.

:CollectionChanged

.. e
CollectionChangeEventArgs
.DataTableCollection






DataRelation Class
.
DataRelationCollection.Add
..
:
- :
. . . . . Boolean Nested .
- :
. . Namespace . . . . . Boolean Nested .
ID
AuthorID :
_ = Dim ID As DataColumn
)"Ds.Tables("Authors").Columns("ID
_ = Dim AuthorID As DataColumn
)"Ds.Tables("Books").Columns("AuthorID
)Dim R As New DataRelation("AuthorsBooks", ID, AuthorID

DataSet
:
)Ds.Relations.Add(R

ParentRelations
ChildRelations .
:
:DataSet
DataSet .
:RelationName
.
:ParentTable
DataTable .
:ChildTable
DataTable .
:ParentColumns
DataColumn
.
:ChildColumns
DataColumn
.
:ParentKeyConstraint
UniqueConstraint

:ChildKeyConstraint
ForeignKeyConstraint
.
:Nested
XML
WriteXml True
.
:ExtendedProperties
PropertyCollection
.






ConstraintCollection Class
InternalDataCollectionBase
Constraint Class .
Collections
Constraint
.. :
:Item

Constraint .
:Add
:
- Constraint .
- UniqueConstraint
.. :
. DataColumn . True .
-
DataColumn Array
.
- ForeignKeyConstraint
.. :
. DataColumn. DataColumn. -
DataColumn Array
.
Constraint
.


..
) (
Un-Typed DataSet

Tables

..Constraints
:

Add ..
:
- :Unique Constraint

:

- :Foreign Key Constraint



:


.
:CanRemove
True
Constraint .. :
UniqueConstraint
ForeignKeyConstraint
Remove
.RemoveAt
:CollectionChanged

.. e
CollectionChangeEventArgs
.DataTableCollection

Constraint Class
Abstract Base Class
UniqueConstraint Class
.ForeignKeyConstraint Class
:
:ConstraintName
.
:Table
DataTable .
:ExtendedProperties
PropertyCollection
.

UniqueConstraint Class

Constraint
.
:
- DataColumn .
-
True .
- DataColumn Array
.
- True
.
- .
- :
. . True .
ID :
(Dim ID As DataColumn = Ds.Tables
)""Authors").Columns("ID
)Dim Uc As New UniqueConstraint("IDUnique", ID, True
:
)Ds.Tables("Authors").Constraints.Add(Uc
" "
EnforceConstraints :True
Ds.EnforceConstraints = True
:
:Columns
.
:IsPrimaryKey
True .

ForeignKeyConstraint Class
Constraint



.
:
- DataColumn
DataColumn
.
-
DataColumn
.
-
.
- :
. . . . . AcceptRejectRule AcceptRejectRule .
Rule DeleteRule .
Rule UpdateRule .
-
.
:

(Dim ID As DataColumn = Ds.Tables


)""Authors").Columns("ID
(Dim AuthorID As DataColumn = Ds.Tables
)""Books").Columns("AuthorID
Dim Fkc As New ForeignKeyConstraint("AuthorIDCnst",
)ID, AuthorID

..
:
)Ds.Tables("Books").Constraints.Add(Fkc
ID
.
:
:RelatedTable
DataTable .
:RelatedColumns
DataColumn Array
.
:Columns
DataColumn Array
.
:AcceptRejectRule

DataRow.AcceptChanges ..DataRow.RejectChanges
AcceptRejectRule:

None
..
.
Cascade
..
:

.
:DeleteRule

Rule:
None




.
Cascade
..

.
SetDefault
.
SetNull
.DbNull
:UpdateRule

Rule
.


Data Views

View
..

.
Index
..
Filtering Sorting Searching
!

..

.
.


IBindingList Interface
IList
Data
Source
.Data-Bound Controls
:
:AllowEdit
True .
:AllowNew
True
.AddNew
:AllowRemove
True
Remove .RemoveAt
:SupportsSorting
True ..
False
.NotSupportedException
:SupportsSearching
True .
:IsSorted
True .

:SortDirection

ListSortDirection:
Ascending .
Descending .
:SortProperty
PropertyDescriptor Class

Objects
..
.
:SupportsChangeNotification
True ListChanged
.
:
:AddIndex
PropertyDescriptor

.
:RemoveIndex
PropertyDescriptor

.

:AddNew

Object
.
:ApplySort
:
PropertyDescriptor .
ListSortDirection . :RemoveSort

.ApplySort
:Find
:
PropertyDescriptor .
Object . :
:ListChanged
.. e
ListChangedEventArgs :





ListChangedType
ListChangedType
:
:Reset .
:ItemAdded . :ItemDeleted . :ItemMoved . :ItemChanged .
:PropertyDescriptorAdded .
:PropertyDescriptorDeleted .
:PropertyDescriptorChanged .
NewIndex
.
OldIndex

.


PropertyDescriptor
PropertyDescriptor

.


ITypedList Interface
Binding
:
:GetListName
.
:GetItemProperties
PropertyDescriptor

PropertyDescriptorCollection ..
Nothing
.



DataViewManager Class
IBindingList ITypedList
MarshalByValueComponent
.

.

DefaultViewManager:
Dim DVM = Ds.DefaultViewManager
:
- .
- ..:
)Dim DVM As New DataViewManager (Ds
:
:DataSet
.
:DataViewSettings
DataViewSettingCollection
ICollection

DataViewSetting .

..

.

DataTable ..:
= Dim Vs As DataViewSetting
)Ds.DefaultViewManager.DataViewSettings(0
:
:CreateDataView
DataTable View

..DataViewSettings DataView
..:
)"Dim TblAuthors As DataTable = Ds.Tables("Authors
Dim DV As DataView = Ds.DefaultViewManager.
)CreateDataView(TblAuthors






DataViewSetting Class

.

DataViewSettings:
= Dim Vs As DataViewSetting
)"Ds.DefaultViewManager.DataViewSettings("Authors
:
:Table
DataTable .
:DataViewManager
DataViewManager
.
:RowStateFilter

DataViewRowState:
None
.
Unchanged
.
Added
.
Deleted
.
.Original Version
OriginalRows
.Current Version
CurrentRows
ModifiedOriginal .
ModifiedCurrent .
:RowFilter

..
.DataRow.Expression
:
"Vs.RowFilter = "Price < 5

:Sort

.. :

:
"Vs.Sort = "Book DESC
:ApplyDefaultSort
True
) ( ..
False .Sort
Views
..
" "
:

:
Load .LstTables
SelectedIndexChanged
LstFields
LstSort
..
)(None
.

..
:ViewSettings
Dim T As DataTable = LstTables.SelectedItem
ViewSettings = Ds.DefaultViewManager.
)DataViewSettings(T
SelectedIndex LstFields LstOp
TxtValue ) (None


.. :
)LstOp.Enabled = (LstField.SelectedIndex <> 0
TxtValue.Enabled = LstOp.Enabled
SelectedIndex :LstSort ) (None
LstSortOrder
ApplyDefaultSort True
..
False
ApplyDefaultSort ..
:

)LstSortOrder.Enabled = (LstSort.SelectedIndex <> 0


ViewSettings.ApplyDefaultSort = Not LstSortOrder.Enabled

:
If LstField.SelectedIndex = 0 Then
"" = ViewSettings.RowFilter
Else
& " " & ViewSettings.RowFilter = LstField.Text
LstOp.Text & " " & TxtValue.Text.Trim
End If

..
' '
.. IN
, ) ( ...
RowFilter

.
Sort :
If LstSort.SelectedIndex = 0 Then
"" = ViewSettings.Sort
Else
& " " & ViewSettings.Sort = LstSort.Text
)"If(LstSortOrder.SelectedIndex = 0, "ASC", "DESC

End If
..

CreateDataView :
Dim Dv = ViewSettings.DataViewManager.
)CreateDataView(ViewSettings.Table
Dgv.DataSource = Dv

!


IBindingListView Interface
IBindingList
Filtering .Sorting
:
:Filter
..:
""Price > 5
:SortDescriptions
ListSortDescriptionCollection
IList
ListSortDescription .
:SupportsAdvancedSorting
True
.
:SupportsFiltering
True
.
:
:RemoveFilter

.


ListSortDescription Class
.
:
PropertyDescriptor .
ListSortDirection .
:
:PropertyDescriptor
PropertyDescriptor
.

:SortDirection
ListSortDirection
.






DataView Class
IBindingListView IBindingList
ITypedList MarshalByValueComponent

.

..

.

DefaultView:
Dim Dv As DataView = TblAuthors.DefaultView
.
:
- .
- DataTable
.
- :
.RowFilter .Sort DataViewRowState .

:
Dim Dv As New DataView(Ds.Books,
'", ' = "Parent(FK_Books_Authors).Author
)"Book", DataViewRowState.CurrentRows
" " .Views
IBindingListView
IBindingList ITypedList
DataViewSetting:
Table
DataViewManager

RowFilter
RowStateFilter
Sort
ApplyDefaultSort


:
)"Dim T As DataTable = Ds.Tables("Books
Dim Dv As DataView = T.DefaultView
" '' < Dv.RowFilter = " Book
"Dv.Sort = "Book, AuthorID DESC
:
:Item

DataRowView
..:
)Dim R As DataRowView = Dv(0

For Each:
For Each R As DataRowView In Dv
))"MsgBox(R("Book
Next
:
:AddNew

DbNull
..

..

DataGridView
.
DataRowView
.
:Delete
..
:
- ) (RowState = Added

.DataTable.RejectChanges
-
) ..(RowState = Deleted
DataTable.RejectChanges
DataView
.Unchanged

Rows
..
Find
.. Dv
:
"Dv.Sort = "Book
)" "(Dim I = Dv.Find
)If I <> -1 Then Dv.Delete(I

:Find
Object
) ..(Sort

.-

.
..CustomDataSet


.. :
DsStudents.Students.DefaultView
) (Idx
.DataRowView
(Dim StdRel = DsStudents.Students.ChildRelations
0).RelationName
Dim RowView = DsStudents.Students.
)DefaultView(Idx
CreateChildView

..

:StudentID
)Dim Grades = RowView.CreateChildView(StdRel
..
..
"
"
.. Find
..

.. Find

SubjectID
:Sort
"Grades.Sort = "SubjectID

) = (-
AddNew ..
StudentID
..
..
..StudentID
..

.. EndEdit
.. Subject
:
Dim SubjRows = DsStudents.Subjects.Rows
For i = 0 To SubjRows.Count - 1
)"Dim SbjID = SubjRows(i)("ID
If Grades.Find(SbjID) = -1 Then
)(Dim Rv = Grades.AddNew
Rv("SubjectID") = SbjID
)(Rv.EndEdit
End If
Next

..
ShowGrades
CellContentClick FrmStudent
SelectedIndex .FrmGrades

:FindRows

DataRowView
.
:ToTable

DataTable .. :
- .
- .
- :
True .
..
..

.
- .







IEditableObject Interface

) (DataRowView
.
:
:BeginEdit
.
:CancelEdit
.
:EndEdit

.


IDataErrorInfo Interface
:
:Error
.
:Item

.


INotifyPropertyChanged Interface
PropertyChanged ..
:
:PropertyChanged
.. e
PropertyChangedEventArgs
PropertyName .

DataRowView Class
IEditableObject IDataErrorInfo
INotifyPropertyChanged
..DataView
.
:
:DataView
DataView .
:Row
DataRow
.
:IsEdit
True .

:IsNew
True
..DataView.AddNew:
)(Dim Rv = Dv.AddNew
MsgBox(Rv.IsNew) ' True
:Item
Default Property

..
:Dv
For Each R As DataRowView In Dv
For I = 0 To Dv.Table.Columns.Count - 1
))MsgBox(R(I
Next
Next
:RowVersion
DataRowVersion
.
:
:Delete

DataView.Delete .
:CreateChildView

..
DataRelation DataView
..

:AuthorsBooks
Dim Rv As DataRowView

)Rv = Ds.Tables("Authors").DefaultView(0
Dim Dv As DataView
)"Dv = Rv.CreateChildView("AuthorsBooks
DataSetSample
..
DataGridView.RowEnter :
e.RowIndex . Binding
DefaultView.Item
:
)"Dim TblAuthors = Ds.Tables("Authors
)Dim RowView = TblAuthors.DefaultView(e.RowIndex


!
CreateChildView
:
= Dim DvBooks As DataView
)"RowView.CreateChildView("AuthorsBooks
DgBooks.DataSource = DvBooks

AuthorID
..
AuthorID
..
:
DgBooks.Columns("AuthorID").Visible = False


Data Binding



.

Data Binding
.
..Data Source
:
- :Fields
Size Object Width
..Height BindingToObject
.
- :
Arrays
Collections
..IList

.. BindingToArray .
- :
IBindingList
ITypedList DataSet
DataTable DataView
..DataViewManager
)
(

) ( ..
.Data Member

..
BindingToDataSet .


IBindableComponent Interfac
:
:DataBindings
ControlBindingsCollection
Binding Objects
.. Binding .
:BindingContext
BindingContext ..
BindingContext .
:ResetBindings
..
.
:BindingContextChanged
.BindingContext
Control Class
IBindableComponent ..
.

Data-Bound Controls
..

.. : Text CheckBox
Checked
..Boolean
Display Member .
:
:Data Source
.. :
Books .
:Data Member
.. Book
.
:Data-Bound Control
..
TextBox ..
.
:Display Member

Text ..


Tag .Text

..System.Windows.Forms .


BindingsCollection Class
BaseCollection
ICollection
.
BindingsCollection
..
Binding .

BindingManagerBase.Bindings .
:
:CollectionChanging
e
CollectionChangeEventArgs
.DataTableCollection
:CollectionChanged
..
.


ControlBindingsCollection Class
BindingsCollection
.Control.Bindings
Add
:
- Binding
.
- :
"."Text Object .Size .. Size ".."Height
""
ToString ..
)
(
.. :

" "Books.Book
.
-
True Format
.
-
DataSourceUpdateMode
DataSourceUpdateMode .
-

..Nothing Object
.

-
Format
.
-
IFormatProvider FormatInfo
.

Binding .
Add
:
"Dim Name As String = "Mohammad
)"" TextBox1.DataBindings.Add("Text", Name,
TextBox1 .Mohammad

..:
)Dim Sz As New Size(100, 200
)"TextBox2.DataBindings.Add("Text", Sz, "Width
TextBox2 .
Add ..
:
)"" TextBox1.DataBindings.Add("Text", Name,
)"TextBox1.DataBindings.Add("Tag", Sz, "Width
Add
.. :
)"" TextBox1.DataBindings.Add("Text", Name,
)"TextBox1.DataBindings.Add("Text", Sz, "Width

Remove:
)"" Dim Bnd = TextBox1.DataBindings.Add("Text", Name,
)TxtName.DataBindings.Remove(Bnd
)"TextBox1.DataBindings.Add("Text", Sz, "Width
.. :
Field ..
Public Variable :
Class Student

Public ID, Age As Integer


Public Name As String
End Class
:
Dim Std As New Student With { .ID = 1, .Age = 15,
}".Name = "Ahmad
) Std (Name
:
)"TxtId.DataBindings.Add("Text", Std, "Name
..
Auto Implemented Properties
Property
:
Class Student
Public Property ID As Integer
Public Property Age As Integer
Public Property Name As String
End Class
Std
.. BindingToObject
.. :
-
..Std
" "

.Std
-
..


.


) (
..
:

Dim B As Binding = TextBox1.DataBindings.Add("Text",


)"Ds, "Books.Book
:
Dim B As Binding = TextBox1.DataBindings.Add("Text",
)"Ds.Tables("Books"), "Book
BindingTextBox
..
DataGridView
.



! ..
!..

.. :
DataGridView1.DataSource = Ds
"DataGridView1.DataMember = "Books
)"TxtBook.DataBindings.Add("Text", Ds, "Books.Book
)"TxtAuthor.DataBindings.Add("Text", Ds, "Books.Author
:
DataGridView1.DataSource = Ds.Books
)"TxtBook.DataBindings.Add("Text", Ds.Books, "Book
)"TxtAuthor.DataBindings.Add("Text", Ds.Books, "Author


) (Ds.Books ) :(Ds
DataGridView1.DataSource = Ds.Books
)"TxtBook.DataBindings.Add("Text", Ds, "Books.Book
)"TxtAuthor.DataBindings.Add("Text", Ds, "Books.Author

) (Ds
) :(Ds.Books
DataGridView1.DataSource = Ds
"DataGridView1.DataMember = "Books
)"TxtBook.DataBindings.Add("Text", Ds.Books, "Book
)"TxtAuthor.DataBindings.Add("Text", Ds.Books, "Author
:
:Control
.
:BindableComponent
IBindableComponent
.

:DefaultDataSourceUpdateMode
DataSourceUpdateMode

DataSourceUpdateMode .

Binding Class


.
ControlBindingsCollection.Add
.Binding
:
}Dim A() As Integer = {1, 2, 3, 4
Text :
)"" Dim B As New Binding("Text", A,
)TextBox1.DataBindings.Add(B
:
"."Text .A ) ( .. Student Structure )
(BindingToArray
" "Name " .."Age .
Binding :
:BindableComponent
IBindableComponent
.
:Control
Control .
:PropertyName
.
:DataSource
Object .
:BindingMemberInfo

BindingMemberInfo Structure
.. .
:BindingManagerBase
BindingManagerBase
.. BindingManagerBase
.
:IsBinding
True False
.
:ControlUpdateMode
..
ControlUpdateMode:
Never

.
OnPropertyChanged
.. .

:NullValue

..Nothing
ControlUpdateMode .None

:DataSourceUpdateMode

DataSourceUpdateMode:
Never
..
)
( .
OnProperty
Changed
..
.
OnValidation

Control.Validated
)
(..
.

:DataSourceNullValue

..Nothing
DataSourceUpdateMode .None
:FormatString

..
.
:FormattingEnabled
True
FormatString .

:FormatInfo
IFormatProvider
..
CultureInfo DateTimeFormatInfo NumberFormatInfo
IFormatProvider
CultureInfo
..
)( .
:
:ReadValue
.
:WriteValue
.
:
:Format

.
e ConvertEventArgs
:
DesiredType Type
.
Value

..
Object .
:
)"e.Value = CType(e.Value, Date).ToString("d/MM/yy
:Parse

..
Format
.
e ..
:
)e.Value = Date.Parse(e.Value.ToString
:BindingComplete

.. e
BindingCompleteEventArgs
:
Binding
Binding
Complete
Context
Binding
Complete
State

ErrorText
Exception

Binding .

BindingCompleteContext:
:ControlUpdate . :DataSourceUpdate .

BindingCompleteState:
:Success . :DataError ..

.
:Exception .

.
Exception
.

Binding Object Text


Book :Ds

)"Dim B As New Binding("Text", Ds, "Books.Book



DataBindings :
)TextBox1.DataBindings.Add (B

..
.ViewAndEditBooks







BindingMemberInfo Structure
..

..
..:
)"Dim Bmi As New BindingMemberInfo ("Books.Book
Books Book
.. )
Ds ( Binding
.BindingMemberInfo

.Binding.BindingMemberInfo
:
:BindingMember
...
. Books.Book :
:BindingField
) ( ..
Book .
:BindingPath
) ( ..
.Books

Width
.Size

BindingContext Class

ICollection
BindingManagerBase ..
BindingManagerBase .

..Control.BindingContext
:
Dim BC As BindingContext = Me.BindingContext
BindingContext
BindingManagerBase
.. BC

) ( ..
.
:
:Item

BindingManagerBase ..
:
. Object
..
Ds
:
) (Me.BindingContext(Ds).SuspendBinding
.
..
..
BindingToDataSet
:
)"Dim Bm = Me.BindingContext(DsBooks, "Books
Bm
Bm.Position
.. :
)Dim Bm = Me.BindingContext(DsBooks


)
( Bm
Bm.Count
)
(
.Bm.Position
:
:Contains
True
.. .Item
:UpdateBinding
BindingContext
Binding
.






BindingManagerBase Class
Abstract Base Class
.. :
. .CurrencyManager Class
. .PropertyManager Class
:
Dim BM As BindingManagerBase

BindingManagerBase ..Binding:
)"" Dim Bnd = TextBox1.DataBindings.Add("Text", Obj,
BM = Bnd.BindingManagerBase
BM ..
BM
PropertyManager ..
BM
CurrencyManager .
:
:Bindings
BindingsCollection
.
:Count
..
..

)
(.

:Position
..


Position ..
:
)"Dim Bnd As New Binding("Text", Ds, "Books.Book
)TxtBook.DataBindings.Add(Bnd
Bnd.BindingManagerBase.Position = 2
BindindSample2

:



:
)Dim Bm As BindingManagerBase = Me.BindingContext(Std

Bm.Position
.
BindindSample2
) (TxtPos

Enter ..
Position
..
Enter Position
.
:Current
Object ..
) (Size


) .(Position
:IsBindingSuspended
True .
:
:AddNew
..

..
RowState.Added
.
:RemoveAt
..

..IBindingList

Deleted .
:CancelCurrentEdit
..
IEditableObject
.DataRowView Class

:EndCurrentEdit
..
IEditableObject
.DataRowView Class
:GetItemProperties
PropertyDescriptorCollection
.. :

PropertyDescriptor ..
:
Dim BM = Bnd.BindingManagerBase
)Dim PD = BM.GetItemProperties(0
MsgBox(PD.Name) ' ID
))MsgBox(PD.GetValue(BM.Current
ID
ID .
:SuspendBinding
..
BindingToArray
CheckBox .
:ResumeBinding
.
:
:BindingComplete
.Binding.BindingComplete
:PositionChanged

..Position e
EventArgs .
BindingToArray
TxtPos
..
AddHandler
:
AddHandler Bm.PositionChanged,
AddressOf Bm_PositionChanged
:CurrentChanged
.Current
:CurrentItemChanged
..
.
:DataError
..
e BindingManagerDataErrorEventArgs
Exception Exception
.

PropertyManager Class
BindingManagerBase
.

.

CurrencyManager Class
BindingManagerBase
.
:
:List
IList
.
:Refresh
..
.Arrays

:
Form Designer
..
ViewAndEditBooks
:

DaAuthorBooks
:
SELECT Authors.Author, Books.ID, Books.Book
FROM Authors INNER JOIN
Books ON Authors.ID = Books.AuthorID
Typed DataSet
DsAuthorBooks
.DsAuthorBooks1
.. :
..DataBinding
.
+ DataBinding ..
Tag ..Text
Tag ID ..
Text .

Text .. :
:None -
.
:Other Data Sources -

:
:Project Data Sources .



..DsAuthorBooks


.
:Form1 List Instances .

..
..DsAuthorBooks1

.. Authos
Join
Query ..Authors
.ID
Text ID
.. Text
Book .Author


..
.

.

..

BindingManagerBase
BindingContext :
= Dim Bm As BindingManagerBase
)"Me.BindingContext(DsAuthorBooks1, "Authors
Position Count
.. :
If Bm.Position < Bm.Count - 1 Then
Bm.Position += 1
LbPosition.Text = Bm.Position + 1 & " / " & Bm.Count
End If



..
Try Catch Catch
) (:
) (Bm.CancelCurrentEdit
..

..

.

) (

.. Update


..
Books.Book :
UPDATE Books
SET Book = @Book
WHERE ID = @Original_ID
.
:Binding List Boxs


.. ListBox
ComboBox CkeckedListBox
Items

Items !




:
:DataSource
.
:DisplayMember
..
BindingListToArray
" "Name .

ToString .
:SelectedValue

.ValueMember
:ValueMember

..SelectedValue BindingListToArray
" "Id SelectedValue

.
ValueMember
SelectedValue
.SelectedItem

ViewAndEditBooks

..
..
ComboBox
..
BookList :

..
.
DataSource

Other Data Sources Form1 List Instances .DsAuthorBooks1
DisplayMember
Authors
.Book

..

!
..

:

:
- .AuthorsBooks_Lists
- DaAuthors .
- DaBooks
.. AuthorID
.
- DsAuthorsBooks
.
- DsAuthorsBooks1

..Edit in Dataset Designer ..XML


Authors_Books .
-

.
- ..
DataSource
..DsAuthorsBooks1 DisplayMember
..
..Authors
..Authors_Books ..
.. ..
..Book


.
:
= CmbBook.DisplayMember
""Authors.Authors_Books.Book
- Text
ID Authors_Books
..Authors
.Authors.Authors_Books.Price
:
TextBox1.DataBindings.Add("Text",
)"DsAuthorsBooks1, "Authors.Authors_Books.ID
TextBox2.DataBindings.Add("Text",
)"DsAuthorsBooks1, "Authors.Authors_Books.Price

-
:
)"DaAuthors.Fill(DsAuthorsBooks1, "Authors
)"DaBooks.Fill(DsAuthorsBooks1, "Books

!
Authors_Books
.. :
:
TextBox1.DataBindings.Add("Text",
)"Ds, "Books.Authors_Books.Author
Authors_Books
! ..
!
BindingTextBox

DataGridView
.. :
TextBox1.DataBindings.Add("Text",
)"Ds, "Authors.Authors_Books.Author


..
!
Author
:
Dim Col As New DataColumn("Author", GetType(String),
)"Parent.Author", MappingType.Hidden
:
)Ds.Books.Columns.Add(Col
:
)"TxtAuthor.DataBindings.Add("Text", Ds, "Books.Author
.







Data Source Configuration Wizard
..
Data Menu
..Add New Data Source
:

:
- :DataBase

Typed DataSet
.
- :Service

..Web Service .
- :Object
..
Students
Next
:


..
Hide System Assemblies ..

Add Reference ..
.Finish
- :SharePoint

..SharePoint 2010 .
..
Database ..Next
Database Model :

:
:DataSet -
.
:Entity Data Model -
LinQ-To-SQL
Entity Framework .
DataSet .Next
..
Books.mdf .Next

Settings ..
.Next
..


:

..
.. +

.

.
Finish
:
Enable Local Database Caching


..
Next ..
.. Finish .
BooksDataSet.xsd ..


AuthorDataAdapter .BookDataAdapter

Data Show Data Sources


Data Sources Explorer
.


) ( ..

BoksDataBooks



.




:

:Add New Data Source


.
:Edit Data Source With Designer
.
:Configure Data Source With Wizard

.
:Refresh
.


:

:
- XLabel X .
- .XTextBox
- BooksDataSet
.
- ..
Book BooksTableAdapter
.
- TableAdapterManager
.
- BindingSource
.. .
- BindingNavigator
.. .
- Load ..
:
)Me.AuthorsTableAdapter.Fill(Me.BooksDataSet.Authors

-
BindingNavigator :

)(Me.Validate
)(Me.AuthorsBindingSource.EndEdit
)Me.TableAdapterManager.UpdateAll(Me.BooksDataSet

..
!

..
.


..
None
.
TextBox
..

Customize :

Data Type


.OK
..
Authors
:
:None . :DataGridView
..


.
:Details
..
) ( .. :
ID
Lable None
CountryID ..

:


..
!


.

..
..Books
..BooksDataSet Books

..
..One-To-Many
:

DataSourceWizard .


.. Master-Details
! ..
AuthorID ..
None AuthorID
Books ..

DataGridViewTextBoxColumn
! ..
Columns
..Collection .

.. : List
ComboBox Text
!

DataSource

Text

DataMember .
MasterDetails ..
:
Authors.Author .
Authors.Books.Book ComboBox .
) (DataBindings ..Text
SelectedValue
.
DataSource AuthorsBindingSource
..
..FK_Books_Authors
..
FKBooksAuthorsBindingSource
! DataSource
DataMember ..Book
.
Authors.Books.Price ..
) (DataBindings ..Text

FKBooksAuthorsBindingSource
.
.. Publish_Date
DateDateTimePicker ..
Value
FKBooksAuthorsBindingSource .
:



..
!..

! .. !




ICurrencyManagerProvider Interface
:
:CurrencyManager
CurrencyManager ..
:GetRelatedCurrencyManager

CurrencyManager ..
"" Nothing

.CurrencyManager


ICancelAddNew Interface

:
:CancelNew

) (.
:EndNew

.. CancelNew
.

IRaiseItemChangedEvents Interface
:
:RaisesItemChangedEvents
True
ListChanged
.

BindingList(Of T) Class
System.ComponentModel
Collection(Of IbindingList IList
)T
ICancelAddNew .IRaiseItemChangedEvents
Generic Type Collection
.Binding
:
- .
- ) IList(Of T
.

:
:ResetBindings
ListChanged Reset
.e.ListChangedType
:ResetItem
ListChanged ItemChanged
.e.ListChangedType

IListSource Interface

List
IList
DataSource .
:
:ContainsListCollection
True
.
:GetList
IList .

BindingSource Class
Component Toolbox
Data .
IList IBindingListView
IcurrencyManagerProvider .ICancelAddNew
Internal List

Binding .
:
- .
- IContainer

..
Form Panel ...GroupBox.
- Object
.

:
:DataSource
Object ..
:
T BindingSource T
.
Nothing
..Add
DataMember DataSource
.Nothing
.

Array Collection .
DataMember
) (
.

.. :
Bs.DataSource = Ds
:
) (Bs.DataSource = Ds.GetType
Typed DataSet
BooksDs :
)Bs.DataSource = GetType(BooksDs


) (DataGridView
..


.


.. :
:None -
.Nothing
:Other Data Sources - :
:Project Data Sources .
..
.
:Form Data Sources .
Lists
DataSets.
:
Add Project data Source


Data Source Configuration Wizard
.Project Data Sources
:DataMember

.
:List
IList
.. :

DataSource
Nothing
Nothing

IListSource


DataMember
List
ArratList.

List

.
.Array

IListSource.GetList

.IBindingList

IBindingList

IList

T

.IList

) IBindingList(Of T
.

ArrayList
.

ICustomType
Descriptor

ArratList
.

).BindingList(Of T

.

IEnumerable

Array Type


DataSource
IListSource

ITypedList

IList


DataMember
List


).BindingList(Of T

).BindingList(Of T

ICustomType
Descriptor

List
.

:Position

.
:Current
Object
.Position
:Sort

) ASC .(DESC

:IsBindingSuspended
True .
:RaiseListChangedEvents
) True (
BindingSource.ListChanged
.
:
:CancelEdit
.
:EndEdit
.
:MoveFirst
).(Position = 0
:MoveLast

).(Position = Count -1
:MoveNext

).(Position += 1
:MovePrevious

).(Position -= 1

:RemoveCurrent
..
:
BindingSource.AllowRemove .False Read Only .Fixed Size
.
:ResetCurrentItem
ListChanged
.
:ResetBindings
ListChanged

True
) ( False
.
DataSource
DataMember
.
.. ResetBindings

ResetCurrentItem ..

) ListBox (DataGridView
) ( ..

ResetBindings

..ResetCurrentItem

.
:ResetItem

ListChanged
..
.

.
:SuspendBinding
.
:ResumeBinding
.

:
BindingComplete
CurrentChanged
CurrentItemChanged
DataMemberChanged
DataSourceChanged
PositionChanged
DataError

ListBindingHelper Class
Shared Methods
BindingSource ..
:
:GetList


.


.
:GetListName
:
. PropertyDescriptor .
:GetListItemType

Type .
:GetListItemProperties
PropertyDescriptorCollection
.. :
. . PropertyDescriptor .

.

BindingNavigator Class

ToolStrip Class


!
:


..

) (
.
Navigator
:

:


DataSet
..
..
ID
.




.
BindingNavigator :
- .
- BindingSource
.
- False
) (.
- IContainer
) ( .
ToolStrip
BindingNavigator :
:BindingSource
BindingSource
.
:AddNewItem
ToolStripItem
..
..ToolStripButton
BindingSource.AllowNew .False
..
Nothing
) (None ..
..
:
) (AuthorsBindingNavigator.BindingSource.AddNew
:DeleteItem
ToolStripItem
..
..ToolStripButton
BindingSource.AllowRemove .False

Nothing
) (None

:
) (AuthorsBindingNavigator.BindingSource.RemoveCurrent

:MoveFirstItem
ToolStripItem
..
.ToolStripButton
:MoveLastItem
ToolStripItem
..
.ToolStripButton
:MoveNextItem
ToolStripItem
..
.ToolStripButton
:MovePreviousItem
ToolStripItem
..
.ToolStripButton

:PositionItem
ToolStripItem
..
ToolStripTextBox
Enter ..

.BindingSource.Position
:CountItem
ToolStripItem
..
ToolStripLabel
.BindingSource.Count
:CountItemFormat
CountItem
.. " of
} .."{0 "
} "{ :

BindingNavigator :

:AddStandardItems

..
..

.
:Validate
True
.
BindingNavigator :
:RefreshItems

.






DataGridView

DataGridView Data
Toolbox



Update .
:
DataGridView DataGrid

.. DataGridView
DataGrid
.

DataSource DataMember :
- DataSource
DataMember:
DataGridView1.DataSource = DsBooks
"DataGridView1.DataMember = "Authors
- DataSource:
)"DataGridView1.DataSource = DsBooks.Tables("Authors
:

:
Columns Header
.
Rows ..

..
) *( New Row
.
:Cells ..
..
Enter Esc
..
CTRL+Enter .
. ..
BindGridToArray
Student :
Grd.DataSource = Std

Student ..
!

Class
: .

DataGridView Class
Control Class
.

.
:
:
:Columns
DataGridViewColumnCollection
DataGridViewColumn Objects
.


:







..
"" ..

Items
.
..Remove
Add
:






:
- :Data-bound Column

..DataSource

..
.
- :Unbound Column

:
..Name

..

) (Col
..
ColAuthors ..ColBooks.

..Type DataGridViewTextBoxColumn

.DataGridViewCombBoxColumn
) ( .Header Text
.Visible
.Read Only
.Frozen
Add
..
.
..


! ..
CustomDataSet
.
Cancel


..
DefaultCellStyle

CellStyle Builder
.. :

CellStyle

..DefaultCellStyle
:
.
Alignment WrapMode .
Font . Format :



:
Null Value
.
.
NumericUpDown
.
Alignment
.. MiddleCentre
Ok .
OK
..
.

:ColumnCount
..


Columns

..
.
:AllowUserToOrderColumns
True
.. .False
:AllowUserToResizeColumns
) True (
.
:AutoGenerateColumns
) True (
.
:AutoSizeColumnsMode

DataGridViewAutoSizeColumnsMode
DataGridViewAutoSizeColumnMode
.NotSet
:ColumnHeadersVisible
False
.. .True
:ColumnHeadersHeight
.

:ColumnHeadersHeightSizeMode

:DataGridViewColumnHeadersHeightSizeMode
EnableResizing .
DisableResizing .
AutoSize
.

:FirstDisplayedScrollingColumnHiddenWidth
.

:FirstDisplayedScrollingColumnIndex
..

..
:
Dgv.FirstDisplayedScrollingColumnIndex = 9
..
.
:SelectedColumns
DataGridViewSelectedColumnCollection
BaseCollection IList
.
:SortedColumn
DataGridViewColumn
.. Nothing
.

:ColumnHeadersBorderStyle

DataGridViewHeaderBorderStyle:
None .
Single .
Raised .
Sunken .
Custom ..

.AdvancedColumnHeadersBorderStyle

:ColumnHeadersDefaultCellStyle
DataGridViewCellStyle
..

.CellStyle Builder

:AdvancedColumnHeadersBorderStyle
DataGridViewAdvancedBorderStyle
.

:AdjustedTopLeftHeaderBorderStyle
DataGridViewAdvancedBorderStyle
.
:EnableHeadersVisualStyles
True
..

ColumnHeadersDefaultCellStyles
RowHeadersDefaultCellStyles :

False
.EnableHeadersVisualStyles
:
:DisplayedColumnCount

True
.
:AdjustColumnHeaderBorderStyle
.. :
DataGridViewAdvancedBorderStyle .
DataGridViewAdvancedBorderStyle .
True .
True .

DataGridViewAdvancedBorderStyle .

.
:AutoResizeColumn
.. :
. .
.
DataGridViewAutoSizeColumnMode
.
:AutoResizeColumns

.. :
. .






.
DataGridViewAutoSizeColumnMode
.
:AutoResizeColumnHeadersHeight
.. :
-
.
-
.
:GetColumnDisplayRectangle
Rectangle
:
. True
False
.
:InvalidateColumn

.

e DataGridViewColumnEventArgs
Column
DataGridViewColumn ..
:
:ColumnAdded
.

:ColumnRemoved
.
:ColumnDisplayIndexChanged
DisplayIndex

.
:ColumnDividerDoubleClick

.. e
DataGridViewColumnDividerDoubleClickEventArgs
:
ColumnIndex .
MouseButtons
Button
.
Clicks
.
Delta
.
X
.
Y
.
Point
Location
.
True
Handled
..
.

:ColumnHeaderMouseClick
..
e DataGridViewCellMouseEventArgs
Handled
RowIndex
.. -
.
:ColumnHeaderMouseDoubleClick
.. e
DataGridViewCellMouseEventHandler
.
:ColumnStateChanged
..Lost Focus
e DataGridViewColumnStateChangedEventArgs
:
DataGridViewColumn
Column
.
StateChanged

DataGridViewElementStates

.DataGridViewElement.State
:ColumnWidthChanged
Width
.

:
:
:RowCount
..



.
:Rows
DataGridViewRowCollection
..DataGridViewRow Objects

..



.
-
-

..
HeaderCell ..
:-
)MsgBox(DGAuthors.Columns(0).HeaderCell.RowIndex
" " DataGridViewAuthorBooks
Rows

Selected .

:SelectedRows
DataGridViewSelectedRowCollection
BaseCollection IList
..
..Add
True Selected
.. :
Dgv.Rows(0).Selected = True

False
Selected :
Do Until DGAuthors.SelectedRows.Count = 0
Dgv.SelectedRows(0).Selected = False
Loop
Dgv.Rows(0).Selected = True


.

..



..
SelectedRows

!
" "
DataGridViewAuthorBooks
:
Dim SelRows = DGAuthors.SelectedRows
For Each R As DataGridViewRow In SelRows
R.Selected = False
Next
DGAuthors.Rows(0).Selected = True

:RowTemplate
DataGridViewRow
..

..
+


DefaultCellStyle
..
FrmBooks DataGridViewAuthorBooks
.
:AllowUserToAddRows
) True (


.
:NewRowIndex
) ( ..
- .
:AllowUserToDeleteRows
) True (
Delete
.
:AllowUserToResizeRows
) True (
.
:CurrentRow
DataGridViewRow
Focused.

:AutoSizeRowsMode

DataGridViewAutoSizeRowsMode:
None
.
AllCells

.Header
AllCells

ExceptHeader
.
AllHeaders

.
DisplayedCells
.
DisplayedCells
ExceptHeaders .
DisplayedHeaders
.
:IsCurrentRowDirty
True
..
:
. Ctrl+Enter .
Form.Validate .
BindingSource EndEdit .
CustomDataSet
CellContentClick
..
:
If DgStudents.IsCurrentRowDirty Then

' ) (DgStudents.EndEdit
'
) (Me.Validate
End If
:FirstDisplayedScrollingRowIndex
..
.
:RowHeadersVisible
False
.. .True
:RowHeadersWidth
.
:RowHeadersWidthSizeMode

DataGridViewRowHeadersWidthSizeMode:
EnableResizing
.
DisableResizing
.
AutoSizeTo

AllHeaders
.
AutoSizeTo

DisplayedHeaders .
AutoSizeTo

FirstHeader
.
:RowHeadersBorderStyle

DataGridViewHeaderBorderStyle .
:RowHeadersDefaultCellStyle

DataGridViewCellStyle
.

:AdvancedRowHeadersBorderStyle
DataGridViewAdvancedBorderStyle
.
:RowsDefaultCellStyle
DataGridViewCellStyle
.

:AlternatingRowsDefaultCellStyle
DataGridViewCellStyle
..
RowsDefaultCellStyle

AlternatingRowsDefaultCellStyle
..

BackColor ..Silver

:

:ShowRowErrors
) True (
.
:ShowEditingIcon

) True (

.
:SortOrder

SortOrder .
:
:AutoResizeRow
.

DataGridViewAutoSizeRowMode
.
:AutoResizeRows
.

DataGridViewAutoSizeRowMode
.

:AutoResizeRowHeadersWidth

DataGridViewRowHeadersWidthSizeMode
.

.
:DisplayedRowCount

True
.
:GetRowDisplayRectangle
Rectangle
:
. True
False
.
:InvalidateRow

.

e DataGridViewRowEventArgs
Row DataGridViewRow
:
:RowErrorTextChanged
ErrorText .
:RowHeadersWidthChanged

.

:RowHeightChanged
Height
.
:RowStateChanged

Focus .. e
DataGridViewRowStateChangedEventArgs :
DataGridViewRow
Row
.
StateChanged
DataGridViewElementStates
.

RowStateChanged :
-
e.Row e.StateChanged
.Selected
-
e.Row e.StateChanged
.Selected
:RowHeaderMouseClick
.. e
DataGridViewCellMouseEventArgs
..
..


.. e.RowIndex
:
)Dim R = DgAuthors.Rows(e.RowIndex

GetRowDisplayRectangle

:
(Dim Pos = DgAuthors.GetRowDisplayRectangle
e.RowIndex, False).Location
..
ErrorText
ErrorText
:
") Then"(If R.ErrorText.Contains
)InsertCntxt.Show(DgAuthors, Pos + e.Location
") Then"(ElseIf R.ErrorText.Contains
)UpdateCntxt.Show(DgAuthors, Pos + e.Location
End If
e.Location
..
.
:RowHeaderMouseDoubleClick
.. e
.DataGridViewCellMouseEventArgs
:RowDividerDoubleClick

.. e
DataGridViewRowDividerDoubleClickEventArgs
:
RowIndex .
Button MouseButtons
.
Clicks
.
Delta
.
X
.
Y
.
Location Point .
Handled True

..
.
:RowPrePaint

.. e
DataGridViewRowPrePaintEventArgs :
RowIndex
.
RowBounds Rectangle
.
ClipBounds Rectangle

..



.
ErrorText
.
Graphics
Graphics
.
Inherited
DataGridViewCellStyle
RowStyle
..
InheritedStyle


InheritedRowStyle
.
True
IsFirst
DisplayedRow .
True
IsLast
VisibleRow .
State

DataGridViewElementStates

PaintParts

Handled

DataGridViewPaintParts:
:None . :All .. .
:Background . :Border . :ContentBackground .
:ContentForeground .
:ErrorIcon . :Focus .Focus
:SelectionBackground .
.OR
True

RowPostPaint
..CellPainting


.

e
:
DrawFocus


:
Rectangle .

True


SelectionBackColor False

..BackColor
.DataGridViewRow.InheritedStyle
PaintCells :
Rectangle .
DataGridViewPaintParts .
PaintCells :
- Background Rectangle
.
True


SelectionBackColor False
.BackColor
PaintCells
Rectangle
Content
.

PaintHeader :
- True

False
.
-
DataGridViewPaintParts
.
:RowPostPaint
.. e
DataGridViewRowPostPaintEventArgs
PaintParts
.Handled

Current Row .


)
... ( ..


:
' Dim Row = DataGridView1.CurrentRow
' If Row Is Nothing Then Return
If Row.Index < > e.RowIndex Then Return

..
e.RowBounds
.. e.Graphics
.
..
:
..Header
.DataGridView.RowHeadersWidth
) (
..


! ..

..

)
(DataGridView.Columns.Count - 1
Displayed ..
DataGridView.GetColumnDisplayRectangle
..
True
..
:
Dim X1 = 0
Dim I = DataGridView1.Columns.Count - 1
If DataGridView1.Columns(I).Displayed Then
Dim ColRect = DataGridView1.
)GetColumnDisplayRectangle(I, True
X1 = ColRect.Left
End If
X1
.


.. X1
!
..X1
:
SystemInformation.VerticalScrollBarWidth

..

..
DataGridView1.ScrollBars
.. :
Dim X2 = 0
Dim RowsHeight = 0
If DataGridView1.ScrollBars = ScrollBars.Both OrElse
DataGridView1.ScrollBars = ScrollBars.Vertical Then
For Each R As DataGridViewRow In DataGridView1.Rows

RowsHeight += R.Height
Next
If RowsHeight > DataGridView1.Height Then
X2 = SystemInformation.VerticalScrollBarWidth + 4
End If
End If
:
)Dim pen As New Pen(Color.Brown
Dim penWidth As Integer = 2
pen.Width = penWidth
..
:

)Dim X = If(X1 = 0, Rect.Left + (penWidth \ 2), X1


)Dim Y As Integer = Rect.Top + (penWidth \ 2
Dim W As Integer = Rect.Width - penWidth
)DataGridView1.RowHeadersWidth - (X1 - X2
Dim H As Integer = Rect.Height - penWidth
:
)e.Graphics.DrawRectangle(pen, X, Y, W, H
..

!
..
RowEnter ..
DataGridView.CurrentRow
e.RowIndex
..
DataGridView.InvalidateRow
.. :
Dim LastRow = DataGridView1.CurrentRow
If LastRow IsNot Nothing Then
)DataGridView1.InvalidateRow(LastRow.Index
End If
)DataGridView1.InvalidateRow(e.RowIndex
.. .
)
(
..
..
DataGridView.Scroll:
_ If e.ScrollOrientation = ScrollOrientation.HorizontalScroll
AndAlso DataGridView1.CurrentRow IsNot Nothing Then

(DataGridView1.InvalidateRow
)DataGridView1.CurrentRow.Index
End If

..


DataGridView
Protected
DataGridView.VerticalScrollBar
Visible
Width .
:RowsAdded

) (.

Sort .. e
DataGridViewRowsAddedEventArgs
:
RowIndex
.
RowCount .
:UserAddedRow
.
:RowsRemoved

e DataGridViewRowsRemovedEventArgs
:
RowIndex
.
RowCount .
:UserDeletingRow

..
e DataGridViewRowCancelEventArgs

CancelEventArgs
True e.Cancel ..
e.Row DataGridViewRow
.. DataGridViewAuthorBooks
:
", "(If MsgBox
MsgBoxStyle.OkCancel) = MsgBoxResult.Cancel Then

e.Cancel = True
End If
..DataSetSample

Foreign Key Constraint


!


..Cascade Delete
UserDeletingRow
.
:UserDeletedRow
..
RowEnter
..
.. :
UserDeletingRow DataSetSample
RowEnter

UserDeletedRow
! .. :
.UserDeletingRow -

.RowEnter -

.UserDeletedRow -

:RowEnter
Focus
..Current Row e
DataGridViewCellEventArgs
:
RowIndex .
ColumnIndex .
..DataGridViewMasterDetails


:

:
- RowEnter :
)Dim R = DGAuthors.Rows(e.RowIndex
- DataGridViewRow.DataBoundItem
DataRowView
:
)Dim DRv = CType(R.DataBoundItem, DataRowView
If DRv Is Nothing Then Exit Sub
- DataRowView.CreateChildView
DataView
.. " ":
)" "(Dim Dv = DRv.CreateChildView

- DataView
:
DGAuthorBooks.DataSource = Dv
.DataGridViewMasterDetails

DataSetSample RowEnter

DefaultView
:
)"Dim TblAuthors = Ds.Tables("Authors
)Dim DRv = TblAuthors.DefaultView(e.RowIndex

:
)"Dim Dv = DRv.CreateChildView("AuthorsBooks
DgBooks.DataSource = Dv


..
DefaultView

.
:RowLeave

! ..
e DataGridViewCellEventArgs
.
:RowValidating
..
.

DataGridViewCellCancelEventArgs
CancelEventArgs True
e.Cancel

..
e.RowIndex

e.ColumnIndex .RowEnter
:RowValidated
..
:
- RowEnter ..
!
- RowLeave .
- Validating .
- Validated .
- RowEnter .
:RowUnshared
Shared Row
..Unshared Row
..

.




:
:
:Item

DataGridViewCell
..
:
)MsgBox(DataGridView1(1, 2).Value

:
)MsgBox(DataGridView1("Author", 2).Value
:CurrentCell
DataGridViewCell ..

.
Header
Disabled Hidden
.
Nothing
Nothing .
:CurrentCellAddress
Point
X Y :
' )MsgBox(Dgv.CurrentCellAddress.X
' )MsgBox(Dgv.CurrentCellAddress.Y
:IsCurrentCellInEditMode
True .

:EditMode

DataGridViewEditMode:
EditOnEnter
..
TAB
.Enter
EditOnKeystroke .
EditOn

..F2 KeystrokeOrF2 .
.F2
EditOnF2
Edit

.BeginEdit Programmatically
EditProgrammatically
.
:EditingControl
Control
..
.Nothing
:EditingPanel
Panel ..
.
:IsCurrentCellDirty
True
.

:FirstDisplayedCell
DataGridViewCell )
( ..

..

.
:TopLeftHeaderCell
DataGridViewHeaderCell


..

....
:SelectedCells
DataGridViewSelectedCellCollection
BaseCollection IList
.
:ShowCellErrors
True
.
:ShowCellToolTips
True
..
ToolTipText .
:ClipboardCopyMode

DataGridViewClipboardCopyMode:

Disable
EnableWith
AutoHeaderText
EnableWithout
HeaderText
EnableAlways
IncludeHeaderText


.


.

.



.

:CellBorderStyle

DataGridViewCellBorderStyle:
None
.
Single
.
SingleVertical
.
SingleHorizontal .
Sunken
.
SunkenVertical .
SunkenHorizontal .
Raised
.
RaisedVertical .
RaisedHorizontal .
Custom
..

.AdvancedCellBorderStyle
:AdvancedCellBorderStyle
DataGridViewAdvancedBorderStyle
.
:DefaultCellStyle

DataGridViewCellStyle
.
:
:SelectAll
.
:AreAllCellsSelected
True
False Visible
True .
:ClearSelection
.

:
. . True False
.
" "
DataGridViewAuthorBooks
:
) (DGAuthors.ClearSelection
DGAuthors.Rows(0).Selected = True
" "

..
CTRL ..
" "

.
:GetClipboardContent

DataObject

..
DataObject Clipboard
" ".

ClipboardCopyMode .Disable


Ctrl+C

.. : Notepad
) (
..
Word .
:GetCellCount

DataGridViewElementStates
.
:GetCellDisplayRectangle
Rectangle
:
. . True False
.

:InvalidateCell
DataGridViewCell
.

.
:BeginEdit
..
True .
:CancelEdit
..
True .
:CommitEdit
..
DataGridViewDataErrorContexts

.. True .
:RefreshEdit

.. )
(
.. True .
:EndEdit

True .

DataGridViewDataErrorContexts
.

:NotifyCurrentCellDirty

.. True
.
..
DataGridColumnTypes
:
OnValueChanged .CalendarEditingControl OnTextChanged TreeEditingControl .TreeComboEditingControl
.. e
DataGridViewCellEventHandler
:
:CellErrorTextChanged
ErrorText .
:CellStateChanged

.. e


DataGridViewCellStateChangedEventArgs
:
DataGridViewCell
Cell
.
StateChanged
DataGridViewElementStates
.
:CurrentCellChanged

CurrentCell
.

:CellValueChanged

..

.
:CurrentCellDirtyStateChanged

..
CheckBox
..CellValueChanged
DataGridColumnTypes

.. :
CurrentCell DataGridViewCheckBoxCell
.
EditedFormattedValue ..
Object CheckState
ToString

) .(

..

CommitEdit .
CommitEdit CurrentCellDirtyStateChanged
..
Boolean
Variable
ExitCurrentCellDirtyStateChanged
Flag True CommitEdit
False

CurrentCellDirtyStateChanged
True ..
.
.DataGridColumnTypes
:CellBeginEdit
.. e
DataGridViewCellCancelEventArgs
True
.e.Cancel
:EditingControlShowing

.. e
DataGridViewEditingControlShowingEventArgs
:
Control Control
..

.

CellStyle
DataGridViewCellStyle

.
..
:
) (Dgv
:
RemoveHandler e.Control.KeyPress,
AddressOf PhoneColumn_KeyPress
If Dgv.CurrentCell.ColumnIndex = 1 AndAlso
e.Control IsNot Nothing Then
AddHandler e.Control.KeyPress,
AddressOf PhoneColumn_KeyPress
End If

KeyPress
) ( ..

..
KeyPress
KeyPress
!
: :KeyPress
Private Sub PhoneColumn_KeyPress(sender As Object,
)e As KeyPressEventArgs
If Not Char.IsDigit(e.KeyChar) AndAlso
e.KeyChar <> Chr(Keys.Back) Then
) (Beep
e.Handled = True
End If
End Sub
:CellEndEdit
.
:CellClick

..
.
:CellMouseClick
e
DataGridViewCellMouseEventArgs
.
:CellContentClick
..
DataGridColumnTypes

DataGridViewAuthorBooks
.

:CellDoubleClick

.
:CellMouseDoubleClick
e
DataGridViewCellMouseEventArgs
.
:CellContentDoubleClick
.
:CellMouseDown

.. e
.DataGridViewCellMouseEventArgs
:CellMouseUp

..
e .DataGridViewCellMouseEventArgs
:CellMouseEnter

.
:CellMouseLeave
.
:CellMouseMove
.. e
DataGridViewCellMouseEventArgs
.
:CellEnter

.


.
:CellLeave

.
:CellValidating
.. e
DataGridViewCellValidatingEventArgs
CancelEventArgs
True e.Cancel

.. :
ColumnIndex
RowIndex

.
.

FormattedValue
.
:CellValidated
.
:CellFormatting

.. DataGridViewCellStyle.Format


..
.

..

.. e
DataGridViewCellFormattingEventArgs :
ColumnIndex
RowIndex
CellStyle
DesiredType
Value
Formatting
Applied

.
.

DataGridViewCellStyle
.
Type
.

.
rue
Value

..
False

.CellStyle

:CellParsing


..

..
.. e
DataGridViewCellParsingEventArgs
:
ColumnIndex .
RowIndex
.
Inherited

DataGridViewCellStyle
CellStyle
.
DesiredType Type
.
Value

.
True
Parsing
Applied

Value
..
False


InheritedCellStyle
.
:CellPainting
..
e DataGridViewCellPaintingEventArgs
:
ColumnIndex .
RowIndex
.
CellStyle

Advanced
BorderStyle
CellBounds
ClipBounds
ErrorText
Graphics

DataGridViewCellStyle
.

DataGridViewAdvancedBorderStyle

.
Rectangle
.
Rectangle

.
.
Graphics
.

State
Value
Formatted
Value
PaintParts
Handled

DataGridViewElementStates
.
.
.



.DataGridViewPaintParts
True

..


.

e :
Paint

Paint
Background

:
Rectangle .
DataGridViewPaintParts .
:
Rectangle .
True SelectionBackColor
False
.BackColor

PaintContent
Rectangle
..

!
:

:
:BackgroundColor

.
:BorderStyle
BorderStyle
:
None
.
FixedSingle
.
Fixed3D ) (.
:GridColor
..

.
:MultiSelect
) True (
.
:ReadOnly
True
.. .False
:ScrollBars

ScrollBars:
None
.
Horizontal .

Vertical
Both

.
.. .

:HorizontalScrollingOffset
..
:
Dgv.HorizontalScrollingOffset = Dgv.Columns(0).Width
:VerticalScrollingOffset
..
!
:SelectionMode

DataGridViewSelectionMode:
CellSelect
FullRow
Select
FullColumn
Select
RowHeader
Select

.

.

..
SortMode
.Automatic

..
.

ColumnHeader
Select
..

SortMode .Automatic

ColumnHeaderSelect FullColumnSelect ..
:
.SelectionMode F4 .
Add Column .. ..
Ok .
Edit Columns ..
SortMode NotSortable
.Ok
SelectionMode .ColumnHeaderSelect
F5 .. !
:
!

.. From1.Designer.vb
..
SelectionMode
ColumnHeaderSelect SortMode
..


!
:
SelectionMode RowHeaderSelect
:

= DataGridView1.SelectionMode
DataGridViewSelectionMode.ColumnHeaderSelect

.
:StandardTab
True TAB

.. False

Ctrl+TAB
.
:UserSetCursor
..Cursor Cursor
Control

.
:
:Sort

ColumnHeaderMouseClick
.. :
- IComparer
) (.
- :
DataGridViewColumn .
ListSortDirection Ascending .Descending
:HitTest
:

X. Y. " "
HitTestInfo DataGridView
:
Nowhere

Column
Index
ColumnX


HitTestInfo
)
(.
.


.
RowIndex
.
RowY

.
Type

DataGridView.HitTestType
:
:None . :Cell. :ColumnHeader . :RowHeader . :TopLeftHeader .
:HorizontalScrollBar . :VerticalScrollBar . MouseMove
SelectionMode
LbInfo .
:
:DataBindingComplete


..DataSource, DataMember, BindingContext :

.
e DataGridViewBindingCompleteEventArgs
ListChangedType
ListChangedType
IBindingList.ListChanged
.Data Views
:DataError

.. e
DataGridViewDataErrorEventArgs
DataGridViewCellCancelEventArgs

..
e.ColumnIndex e.RowIndex

.. e.Cancel
.
e :
Context

DataGridViewDataErrorContexts
.

Exception Exception
.
Throw True
Exception
..
.False
:
-

!
-
..
!
:
e.Cancel = True
) (Beep
:
- .
-
.
:Scroll
.. e
ScrollEventArgs :
OldValue .
NewValue .
ScrollOrientation
Scroll
Orientation ..
:
:HorizontalScroll . :VerticalScroll - .

Type

ScrollEventType
:
:SmallDecrement .
:SmallIncrement .
:LargeDecrement .
:LargeIncrement .
:ThumbPosition .
:ThumbTrack .
:EndScroll . :First . :Last - .

:SelectionChanged
.
:SortCompare


.VirtualMode
e :
Column
CellValue1
CellValue2
RowIndex1
RowIndex2
SortResult

DataGridViewColumn
.
.
.
.
.

:

Handled

.
.
. True

.


..

.. :
-
-
-
-

CellValue1 CellValue2
.SortResult
CellValue1 CellValue2
.Col2
RowIndex1 RowIndex2
Col2
.SortResult
Col2
.

If e.CellValue1.ToString < e.CellValue2.ToString Then


e.SortResult = -1
ElseIf e.CellValue1.ToString > e.CellValue2.ToString Then

e.SortResult = 1
' Else
Dim V1 As String = DataGridView1("Col2",
) (e.RowIndex1).Value.ToString
Dim V2 As String = DataGridView1("Col2",
) (e.RowIndex2).Value.ToString
If V1 < V2 Then
e.SortResult = -1
Else
e.SortResult = 1
End If
End If
e.Handled = True
:Sorted
.






:VirtualMode

VirtualMode
ListView "
".


..
:
-
.
-


..
.
-
..


..CellValueNeeded VirtualModeSample

) (


:
= . +
= ) ( +
) .( +


..

..
!

:
:VirtualMode
True

.
:UpdateRowErrorText
RowErrorTextNeeded
..
:
. ..
- .
.
: .
:UpdateRowHeightInfo
RowHeightInfoNeeded
..
:
.. - .
True .
:UpdateCellValue
CellValueNeeded
.. :
.. - .
.. - .
:UpdateCellErrorText
CellErrorTextNeeded
.. :

.. - .
.. - .
:CellValueNeeded

..
VirtualModeSample
ArrayList .

DataGridViewCellValueEventArgs :
ColumnIndex .
RowIndex .
Value
..

.
:CellValuePushed


) ( .. e
DataGridViewCellValueEventArgs .
:NewRowNeeded
) (
..
..
CellValueNeeded
VirtualModeSample
.
:DefaultValuesNeeded

.

DataGridViewRowEventArgs
e.Row

CellValuePushed
.
:CancelRowEdit
.
e QuestionEventArgs
Response True
) ( False
) (.
:RowDirtyStateNeeded

.. e
QuestionEventArgs
e.Response ) True (
CancelRowEdit
..Esc
False
.CancelRowEdit
:RowErrorTextNeeded


.. e
DataGridViewRowErrorTextNeededEventArgs
:
RowIndex .
ErrorText .
:CellErrorTextNeeded



.. e
DataGridViewCellErrorTextNeededEventArgs
:
ColumnIndex .
RowIndex .
ErrorText

.
:CellToolTipTextNeeded


.. e
DataGridViewCellToolTipTextNeededEventArgs
:
ColumnIndex .
RowIndex .
ToolTipText
.
:RowContextMenuStripNeeded


..
..

DataGridViewRowContextMenuStripNeededEventArgs
:
RowIndex
Context
MenuStrip

.

ContextMenuStrip .

:CellContextMenuStripNeeded



..
.

.RowContextMenuStripNeeded

DataGridViewCellErrorTextNeededEventArgs
:
ColumnIndex .
RowIndex
.
Context

MenuStrip ContextMenuStrip
.
:RowHeightInfoNeeded


..
.. e
DataGridViewRowHeightInfoNeededEventArgs
:
RowIndex
.
Height
.
MinimumHeight
.
:RowHeightInfoPushed

.

DataGridViewRowHeightInfoPushedEventArgs
:

RowIndex
.
Height
.
MinimumHeight .
True
Handled


.
:
..



..


!


..:
- DataGridView.DefaultCellStyle


..
DataGridViewCell.Style
.
-
DataGridView.RowTemplate

.
-

CellFormatting ..


.
- InheritedStyle
Style Style
!
- ContextMenuStrip

.
- DataGridView.RowTemplate
.
-
RowContextMenuStripNeeded
.
-
CellContextMenuStripNeeded
.
- Auto-Sizing


! ..
DisplayedCells
DisplayedCellsExceptHeaders AutoSizeMode




AutoSizeToDisplayedHeaders

..AutoSizeToFirstHeader

:
.UpdateRowHeightInfo .Scroll .RowDividerDoubleClick .ColumnDividerDoubleClick -
SelectedColumns SelectedRows

SelectedCells
.

- DataGridView.GetCellCount
.SelectedCells.Count
- Rows.GetRowCount
.SelectedRows.Count
- Columns.GetColumnCount
.SelectedColumns.Count
-
SelectionMode FullRowSelect
.FullColumnSelect
- Shared Rows .. ..
.. .
:Shared Rows

RowTemplate
..

.. ..
!

.


!.
Binding
Virtual Mode

.
:

.

..
:

.. .
ToolTipText ContextMenuStrip ..
CellToolTipTextNeeded CellContextMenuStripNeeded
.
Items .

:
-
Rows Add Insert
.

.
- Rows
..For Each

GetErrorText
GetContextMenuStrip
.GetState GetPreferredHeight
- DataGridViewRow.Cells
.
-
e
.
- CurrentCellAddress
.
- Rows.SharedRow
..
!
- GetContextMenuStrip
ContextMenuStrip
-
.

- CollectionChanged RowStateChanged
.
- SelectionMode FullColumnSelect
ColumnHeaderSelect FullRowSelect RowHeaderSelect

DataGridView.SelectedCells
!
- SelectionMode CellSelect
DataGridView.SelectAll .
- DataGridView.AreAllCellsSelected
!
- False ReadOnly Selected
True
.
- DataGridView.Rows.List
!
- ) DataGridView.Sort(IComparer

.
- RowUnshared
.
SharedRow
-
..! -
:
If DataGridView1.Rows.SharedRow(0).Index = -1 Then
)" "(MsgBox
End If
:
..

..
.Paging
:Paging


ASP.NET Web Applications

) (

.


!
..
:

.. LinkLable


..



! ..
.
..

.. RowsNo
.
:
..DataGridViewPaging .
Data Add New Data Source
.
AuthorsTableAdapter
Configure :
SELECT * FROM dbo.Authors

WHERE ID BETWEEN @StartID AND @EndID


.. Fill
StartID EndID
.
AuthorsTableAdapter
Add Query

SQL:
SELECT MAX(ID) FROM Authors
..GetMaxID

.
BooksTableAdapter
Configure
:
SELECT Books.* FROM dbo.Books, Authors
WHERE AuthorId = Authors.ID
AND Authors.ID BETWEEN @StartID AND @EndID
.. Fill
StartID EndID
.

..
.
Data
Show Data Sources ..
..

StartID EndID
..Fill ..

:


RowVersion
..
.ColBooks
FrmBooks
.

CellContentClick
FrmBooks ..
DataGridViewAuthorBooks .

BooksTableAdapter
..


..
..

.
..

.
LinkLabel LnkPage1
" "
..

..Anchor
.
..LinkClicked
:
= + ) ( -
:
= + .
..

Sender .
..
:
)Dim Lnk = CType(sender, LinkLabel
)Dim StartID = 1 + RowsNo * (CInt(Lnk.Text) - 1
AuthorsTableAdapter.Fill(BooksDataSet.Authors,
)StartID, StartID + RowsNo
BooksTableAdapter.Fill(BooksDataSet.Books, StartID,
)StartID + RowsNo
..

:
Dim MaxID = AuthorsTableAdapter.GetMaxID
)Dim PagesNo = Math.Ceiling(MaxID / RowsNo

..
LnkPage1
PrvLnk
..
.. :
Dim PrvLnk = LnkPage1
For I = 2 To PagesNo
Dim Lnk As New LinkLabel
)Me.Controls.Add(Lnk

Lnk.Visible = True
Lnk.Text = I
Lnk.Font = PrvLnk.Font
Lnk.AutoSize = True
Lnk.Location = PrvLnk.Location)New Point(Lnk.Width + 10, 0
Lnk.Anchor = PrvLnk.Anchor
AddHandler Lnk.LinkClicked,
AddressOf LnkPage1_LinkClicked
PrvLnk = Lnk
Next
AutoSize True
..
Text
.

..
PerformClick
LnkPage1_LinkClicked
:
LnkPage1_LinkClicked(LnkPage1,
))New LinkLabelLinkClickedEventArgs(Nothing

..
.
..
! .. ID
..
! ..

!

..DataGridViewPaging2
.
:

@Count
:FillFirstPage
SELECT TOP (@Count) * FROM Authors
FillFirstPage
:
* SELECT
FROM Books INNER JOIN
Authors ON Books.AuthorID = Authors.ID
WHERE Authors.ID IN
)(SELECT TOP (@Count) ID FROM Authors
SELECT

.
..


!

..
.. ..
:
)SELECT TOP (11 - 1
ID FROM Authors AS PrvPages
ORDER BY ID
MAX:
)SELECT MAX(ID
( FROM
)SELECT TOP (11 -1
ID FROM Authors AS PrvPages
ORDER BY ID
) AS MaxID

@AuthorNo
..ID :
+ ) ( - .



..@Count :
)SELECT TOP (@Count
* FROM Authors
( > WHERE ID
)SELECT MAX(ID
( FROM
)SELECT TOP (@AuthorNo -1
ID FROM Authors AS PrvPages
ORDER BY ID
) AS MaxID
)
:

..
..
Advanced Options
..

UpdateCommand ..CommandText

..
) ( Cut ..Paste
..
.InsertCommand

:
SELECT * FROM Books
INNER JOIN Authors
ON Books.AuthorID = Authors.ID
WHERE Authors.ID IN

(
)SELECT TOP (@Count
ID FROM Authors
> WHERE ID
(
)SELECT MAX(ID
( FROM
)SELECT TOP (@AuthorNo -1
ID FROM Authors AS PrvPages
ORDER BY ID
) AS MaxID
)
)
..
IN
: ID
ID .
..DataGridViewPaging2


.. .
.. ..
..
) ( ..
""
" "
.
:
LnkPrv "".
LnkNext "". MaxLinks .
:

PageLinks -
) List(Of LinkLabel
.. .
CurLink - )
( ..
"" "".
FirstPageNo -
..
"".
PagesNo - .
..MaxLinks :
)For I = 2 To Math.Min(PagesNo, MaxLinks
Next
..PageLinks
LnkPage1 :
)PageLinks.Add(LnkPage1
)For I = 2 To Math.Min(PagesNo, MaxLinks
'
)PageLinks.Add(PrvLnk
Next
LinkClicked " " ""
:
)Dim I = CInt(Lnk.Text
)LnkPrev.Enabled = (I > 1
)LnkNext.Enabled = (I < PagesNo
) ( ..
..
LinkClicked:
'
CurLink.Enabled = True
CurLink.Font = New Font(CurLink.Font,

)FontStyle.Regular
'
Lnk.Enabled = False
)Lnk.Font = New Font(Lnk.Font, FontStyle.Bold
CurLink = Lnk
"" :
Dim I = CurLink.Text
LnkPage1_LinkClicked(PageLinks(I - FirstPageNo + 1),
))New LinkLabelLinkClickedEventArgs(Nothing

..

MaxLinks ..

..
FirstPageNo
.. :
Dim I = CurLink.Text
If I = MaxLinks Then
For Each Lnk In PageLinks
Lnk.Text += MaxLinks
If Lnk.Text > PagesNo Then Lnk.Visible = False
Next
FirstPageNo += MaxLinks
End If
LnkPage1_LinkClicked(PageLinks(I - FirstPageNo + 1),
))New LinkLabelLinkClickedEventArgs(Nothing
" " .. " "
..
.. :
Dim I = CurLink.Text
If I = FirstPageNo Then
For Each Lnk In PageLinks
Lnk.Text -= MaxLinks
Lnk.Visible = True
Next

FirstPageNo -= MaxLinks
End If
LnkPage1_LinkClicked(PageLinks(I - FirstPageNo - 1),
New LinkLabelLinkClickedEventArgs(Nothing))
..
!

DataGridView
:

DataGridViewElement Class
DataGridViewBand Class
DataGridViewColumn Class
DataGridViewButtonColumn Class
DataGridViewCheckBoxColumn Class
DataGridViewComboBoxColumn Class
DataGridViewImageColumn Class
DataGridViewLinkColumn Class
DataGridViewTextBoxColumn Class

DataGridViewRow Class

DataGridViewCell Class
DataGridViewButtonCell Class
DataGridViewCheckBoxCell Class
DataGridViewComboBoxCell Class
DataGridViewImageCell Class
DataGridViewLinkCell Class
DataGridViewT extBoxCell Class
DataGridViewHeaderCell Class
DataGridViewColumnHeaderCell
DataGridViewRowHeaderCell

DataGridViewElement Class
:
:
:DataGridView
DataGridView .
:State
DataGridViewElementStates
:
None
.
Frozen
) ( ..
.
ReadOnly .
Resizable ..

.ResizableSet
ResizableSet
.
.Highlighted
Selected
Displayed
.
Visible
) ( ..
Displayed
.
Flag
:And
If (DataGridView1.Rows(0).State And
DataGridViewElementStates.Displayed) > 0 Then
)MsgBox(DataGridView1.Rows(0).State.ToString
End If

DataGridViewBand Class
DataGridViewElement
ICloneable .IDisposable

Band
.
:
:ContextMenuStrip
ContextMenuStrip
..
! ..

.
:
- .
- .
- .

.
:DefaultHeaderCellType
Type )
(
DataGridViewHeaderCell ..
.

..
DataGridViewColumnHeaderCell
DefaultHeaderCellType
.
:Frozen

True
..
.
) (
.
:Index
..

.
)
(
..DisplayIndex

..

DataGridViewRow .
:DefaultCellStyle
DataGridViewCellStyle
..
DataGridViewCellStyle .
:HasDefaultCellStyle
True ..DefaultCellStyle
DefaultCellStyle Nothing
! ..
HasDefaultCellStyle
DefaultCellStyle .

:InheritedStyle
DataGridViewCellStyle
..
DefaultCellStyle
.
:ReadOnly
True
.
:Resizable
)
( ..
DataGridViewTriState:
NotSet
.
True True .
False False .
:Selected
True ..
True
..
.
SelectionMode
:
SelectionMode FullRowSelect RowHeaderSelect Select
.


SelectionMode
FullColumnSelect ColumnHeaderSelect
Select
.
:Displayed

True
.
:Visible
False
.
:Tag

.

BaseCollection Class
ICollection
..

:
IsReadOnly
Count
SyncRoot
IsSynchronized
GetEnumerator
CopyTo


DataGridViewColumnCollection Class
BaseCollection IList

.DataGridViewColumn Class

DataGridView ..:
(Dim Cols As New DataGridViewColumnCollection
)DataGridView1


DataGridView1 Cols

!! DataGridView1

.. :
:Add

.. :
- DataGridViewColumn
.
-
DataGridViewTextBoxColumn
..
Col1 ":"
)"DataGridView1.Columns.Add("Col1", "
:
. CellType .Nothing
Frozen .

DisplayIndex .
Add :CellEnter, CellLeave, CellValidating, CellValidated,
RowEnter, RowLeave, RowValidated, RowValidating.

SortMode Automatic DataGridView.SelectionMode


FullColumnSelect .ColumnHeaderSelect
InheritedAutoSizeMode ColumnHeader
).(DataGridView.ColumnHeadersVisible = False
InheritedAutoSizeMode Fill ).(Frozen = True
:Item

DataGridViewColumn ..
Col1 :
)MsgBox(DataGridView1.Columns("Col1").Index
:GetColumnCount

..DataGridViewElementStates
:
(MsgBox(DataGridView1.Columns.GetColumnCount
))DataGridViewElementStates.Selected
:GetColumnsWidth

..DataGridViewElementStates
:
(MsgBox(DataGridView1.Columns.GetColumnsWidth
))DataGridViewElementStates.Visible
:GetFirstColumn

DataGridViewElementStates
.. Nothing
.

DataGridViewElementStates
..
:
= Dim DgCol As DataGridViewColumn
(DataGridView1.Columns.GetFirstColumn
DataGridViewElementStates.Visible,
)DataGridViewElementStates.Displayed
:GetLastColumn

.
:GetNextColumn
DataGridViewColumn
:
- DataGridViewColumn
.
- DataGridViewElementStates
.
- DataGridViewElementStates
.
Nothing .

:
Dim Cols = DataGridView1.Columns
(Dim DgCol = Cols.GetFirstColumn
DataGridViewElementStates.Displayed,
)DataGridViewElementStates.Resizable

Do Until DgCol Is Nothing


MsgBox(DgCol.Name)
DgCol = Cols.GetNextColumn(DgCol,
DataGridViewElementStates. Displayed,
DataGridViewElementStates.Resizable)
Loop
:GetPreviousColumn

..
GetLastColumn
:
Dim Cols = DataGridView1.Columns
Dim DgCol = Cols.GetLastColumn(
DataGridViewElementStates.Displayed,
DataGridViewElementStates.Resizable)
Do Until DgCol Is Nothing
MsgBox(DgCol.Name)
DgCol = Cols.GetPreviousColumn(DgCol,
DataGridViewElementStates. Displayed,
DataGridViewElementStates.Resizable)
Loop
:CollectionChanged

e ..
CollectionChangeEventArgs
.DataTableCollection

DataGridViewColumn Class
DataGridViewBand .IComponent
:
- .
- DataGridViewCell
CellTemplate ..
Template
.
:
:Name
..

Remove .Contains
:ValueType
Type
.
:ToolTipText

.
:Width
.
:MinimumWidth

..
.
:AutoSizeMode


DataGridViewAutoSizeColumnMode:
NotSet
.
None
.
AllCells

.
AllCells

ExceptHeader .
DisplayedCells
.
DisplayedCells
ExceptHeader .
ColumnHeader ..

).(ColumnHeadersVisible = False
Fill

..
.Frozen

.
:InheritedAutoSizeMode

AutoSizeMode NotSet InheritedAutoSizeMode
.

:FillWeight


InheritedAutoSizeMode ..Fill

..
) (Sum
) ..(FillWeight/Sum Sum


.. .
:SortMode

DataGridViewColumnSortMode:
Automatic


..

..
SelectionMode
FullColumnSelect
.ColumnHeaderSelect
NotSortable

..


.
Programmatic
.

..

.
List
!

DataSource
..
IsSortable = True
Lists Collections
.BindingList

SortableBindingList
..
..
.. Coin100Pictures
Generic
Type
Constructor
.. :
(Dim SortedList As New SortableBindingList
)Of PictureInfo)(Coins.PicsInfo.Values.ToList
DataGridView1.DataSource = SortedList
:
PictureInfo ..
.
Coins.PicsInfo.Values Collection ..PictureInfo
ToList
SortableBindingList
LinQ .
..
..DataGridView.DataSource


.

!
:
SortableBindingList
..PropertyComparer


!! ..
!
:IsDataBound
True .
:DataPropertyName

..

.

..

Data Source
..

VirtualMode


)
..( ..

!

..
Database

CheckBox
..


..Typed DataSet
) Auto Generated
(Designer.vb ..

DataSet View Code
Partial
Class
Public Property .

Data Sources
BindingSource

DataPropertyName .
.
:

CellStyle
..DataGridView.DefultCellStyle
:
-

. DataGridView.RowsDefultCellStyle
. DataGridViewRow.DefultCellStyle
. DataGridViewCell.CellStyle


DataGridViewCell.InheritedCellStyle


)
(!

:DisplayIndex
..

.Index
:DividerWidth
..


..
:


.
:HeaderCell

DataGridViewColumnHeaderCell
.. .

Header Cell ..
DataGridView.EnableHeadersVisualStyles False
True

ColumnHeadersDefaultCellStyle

RowHeadersDefaultCellStyle Style
:
Dgv1.EnableHeadersVisualStyles = False
X:
Dgv1.Columns(X).HeaderCell.Style.BackColor = Color.Red

.ForeColor
:HeaderText

.
:CellTemplate
DataGridViewCell
.
:CellType
Type
..CellTemplate CellTemplate
DataGridViewCell CellType
..
DataGridViewCell .
:
:GetPreferredWidth
:
DataGridViewAutoSizeColumnMode .
True False

Word wrap
.
DataGridViewColumn :
- .DataGridViewTextBoxColumn
- .DataGridViewButtonColumn
- .DataGridViewCheckBoxColumn
- .DataGridViewComboBoxColumn
- .DataGridViewImageColumn
- .DataGridViewLinkColumn

.. "
" DataGridColumnTypes
.DateTimePicker

CalendarColumn
..DataGridViewColumn
Override
: New
CellTemplate

CalenderCell
..
.

TreeView
" "
.



..
"


"

..TreeComboBox
" ".


DataGridViewTextBoxColumn Class
DataGridViewColumn
DataGridViewTextBoxCell
..
" " DataGridColumnTypes
.

.
:

:MaxInputLength
..

.







DataGridViewButtonColumn Class
DataGridViewColumn
DataGridViewButtonCell Button
.. " "
DataGridColumnTypes .
:
:Text

.
:UseColumnTextForButtonValue
) False (
Text
.
:FlatStyle
FlatStyle:
Standard ..
.
Flat

.
Popup
.
System
.


DataGridViewCheckBoxColumn Class
DataGridViewColumn
DataGridViewCheckBoxCell
..CheckBox " "
DataGridColumnTypes .
:
- .
- Boolean
ThreeState .
:
:FlatStyle
.
:ThreeState
True
) ..(Indeterminate

) (
.
) False (
) (Checked Unchecked

.
:FalseValue
Object
.Unchecked
:TrueValue
Object .Checked

:IndeterminateValue
Object
.Indeterminate
FalseValue TrueValue

IndeterminateValue ..

.. :
FalseValue .
TrueValue .
IndeterminateValue
.
: Checked


DataGridView.CellContentClick ..
:
e.ColumnIndex DataGridViewCheckBoxColumn
.
..DataGridView.CurrentCell
) :(Dgv
)Dim Cell = Dgv.Rows(e.RowIndex).Cells(e.ColumnIndex

CurrentCell
..

!

Cell.Value !! ..
Cell.EditedFormattedValue :
If CBool(Cell.EditedFormattedValue) then
)" "(MsgBox
End If
) CellValueChanged
(!! ..
CheckedChanged CheckBox

! DataGridView.EditingControlShowing
:
DataGridViewCheckBoxColumn
DataSource
..


SaveChanges
..

(I :
) (Dgv.EndEdit
For Each Row As DataGridViewRow In Dgv.Rows
If CBool(Row.Cells(I).Value) Then
'
Else
'
End If
Next
EndEdit
.


DataGridViewImageColumn Class
DataGridViewColumn
DataGridViewImageCell ..
" " DataGridColumnTypes
.
:
- .
- Boolean
valuesAreIcons .
:
:Description

.
:ValuesAreIcons
True
..Icon ) False
(
.Image
:Icon
Icon
ValuesAreIcons .True
:Image
Image
ValuesAreIcons .False

:ImageLayout

DataGridViewImageCellLayout:
NotSet ) (.
Normal ..
.
Stretch ..

.
Zoom

.

TimeStamp ..
.

.. :
. Edit Columns .. .
. ColumnType Design DataGridTextBoxColumn
..DataGridImageColumn
..
ColumnType

..
.
False Visible :
DGAuthors.Columns("RowVersion").Visible = False

DataGridViewLinkColumn Class
DataGridViewColumn
DataGridViewLinkCell ) (
..Link " "
DataGridColumnTypes .
:
:Text
.
:UseColumnTextForLinkValue
) False (
Text
.
:LinkBehavior
:LinkBehavior
AlwaysUnderline .
HoverUnderline
.
NeverUnderline .
SystemDefault
.
:LinkColor
..
.

:ActiveLinkColor
..
.
:VisitedLinkColor
..
.
:TrackVisitedState
) True (
.VisitedLinkColor
CustomDataSet
" ".


DataGridViewComboBoxColumn Class
DataGridViewColumn
DataGridViewComboBoxCell
..Combo Boxes " "
DataGridColumnTypes .
:
:FlatStyle
.
:DropDownWidth
..


! ..
..
:
)Actual Width = Max (DropDownWidth, Col Width
:AutoComplete
) True (
.
:DataSource

:Countries
)"Col.DataSource = Ds.Tables("Countries
:
) (. - ) (.

:DisplayMember
..
Name :
"Col.DisplayMember = "Name
:

DisplayMember

..DataGridColumnTypes

.
:ValueMember
DataPropertyName
.. : UpdateErrors2
CountryID
:
'
)"DataGridView1.Columns.Remove("CountryID
'
) (Dim Col As New DataGridViewComboBoxColumn
"Col.Name = "Country
'
)"Col.DataSource = Ds.Tables("Countries
"Col.DisplayMember = "Name
'
)DataGridView1.Columns.Insert(2, Col

..Name
) ( CountryID
.
.. ..
ID

) ( CountryID
) ( :
"Col.ValueMember = "ID
"Col.DataPropertyName = "CountryID
:Items
ObjectCollection
IList DataGridViewComboBoxCell
Object
.. DataSource
..Items : Items
DataSource

..Items DataSource
Items
!
:DisplayStyle

DataGridViewComboBoxDisplayStyle:
ComboBox

.
DropDownButton
.
Nothing


.

:DisplayStyleForCurrentCellOnly
True DisplayStyle
..
.False
Nothing DisplayStyle
True DisplayStyleForCurrentCellOnly

! ..
!
:MaxDropDownItems


..
.
:Sorted
True
.
:


..CellTemplate
.


DataGridViewRowCollection Class
IList
.DataGridViewRow
DataGridView
..
Rows .
:
:Add

:
- .
- DataGridViewRow
.
- Object Array

.
:
. . Frozen .
.
Add :CellEnter, CellLeave, CellValidating, CellValidated,
RowEnter, RowLeave, RowValidated, RowValidating.

).(DataGridView.VirtualMode = True
).(DataGridView.DataSource <> Nothing



DataGridView.Sort DataGridView.RowsAdded
.
:AddCopy

.
:AddCopies


.
:Insert
..

:
-
.
-
Object Array
.
-
DataGridViewRow .
:InsertCopy
:
. . :InsertCopies


.
:GetRowState
..
DataGridViewElementStates
.DataGridViewElement.State
:GetFirstRow

..DataGridViewElementStates -
.

DataGridViewElementStates
..
:
(MsgBox(DataGridView1.Rows.GetFirstRow
DataGridViewElementStates.Displayed,
))DataGridViewElementStates.Selected
:GetLastRow

.
:GetNextRow
:
- .
- DataGridViewElementStates
.

DataGridViewElementStates
.

:
Dim Rows = DataGridView1.Rows

(Dim Pos = Rows.GetFirstRow


DataGridViewElementStates.Displayed,
)DataGridViewElementStates.Resizable
Do Until Pos = -1
)MsgBox(Pos
Pos = Rows.GetNextRow(Pos,
DataGridViewElementStates.Displayed,
)DataGridViewElementStates.Resizable
Loop
:GetPreviousRow

..
:
Dim Rows = DataGridView1.Rows
Dim Pos = Rows.Count -1
Do
Pos = Rows.GetPreviousRow(Pos,
DataGridViewElementStates.Displayed,
)DataGridViewElementStates.Resizable
If Pos = -1 Then Exit Do
)MsgBox(Pos
Loop

..-
) *
( ..
) (Count + 1
.
:GetRowCount

..DataGridViewElementStates
:
(MsgBox(DataGridView1.Rows.GetRowCount
))DataGridViewElementStates.Selected

:GetRowsHeight

.DataGridViewElementStates
:SharedRow
DataGridViewRow
..
Shared Rows .
:
:CollectionChanged

.. e
CollectionChangeEventArgs
.DataTableCollection

DataGridViewRow Class
DataGridViewBand
.. :
:AccessibilityObject
AccessibleObject
) (
.. .
:Cells
DataGridViewCellCollection
..

:
)MsgBox(DataGridView1.Rows(0).Cells(0).Value



.
:
)MsgBox(DataGridView1.Rows(0).Cells("Col1").Value

.


) (ColName Index
:
(MsgBox(DataGridView1.Rows(0).Cells
)ColName.Index).Value


.
:DataBoundItem

..
BindGridToArray Student
..Std
DataBoundItem
.

DataRowView
.

.
:Height
..
+ .9 Pixels
:MinimumHeight
..
.
:DividerHeight
..


..
:

:ErrorText


ErrorText
.


.ErrorText
:HeaderCell
DataGridViewRowHeaderCell
.
:IsNewRow
True
* ..

.
:
:AdjustRowHeaderBorderStyle
..
:
DataGridViewAdvancedBorderStyle .
.
True .
True .
True .

True .

DataGridViewAdvancedBorderStyle .

.
:CreateCells

CellTemplate
.. :
- DataGridView
.
-
Object Array
.
:GetContextMenuStrip
ContextMenuStrip
.
:GetErrorText
.
:GetPreferredHeight
:
. DataGridViewAutoSizeRowMode :
AllCells

.
AllCells

ExceptHeader .
RowHeader

.Header
True .. False

.
:GetState

DataGridViewElementStates .
:
GetErrorText GetContextMenuStrip
GetState GetPreferredHeight
Shared



..
) (
GetState ) (:
)MsgBox(DataGridView1.Rows(2).GetState(0).ToString
!
)MsgBox(DataGridView1.Rows(0).GetState(0).ToStrin

DataGridViewRow.Index
- Shared Row
! ..
Index -
!


.
:SetValues

Object Array
.. True
..False


..False

.

) Value-Type Array (

! .. :
:}Dim Arr( ) As Integer = {1, 2, 3, 4
Dim O(Arr.Length - 1) As Object
)Arr.CopyTo(O, 0
)Row.SetValues(O

:
)Row.SetValues(1, 2, 3, 4

DataGridViewCell Class
DataGridViewElement
Abstract Base Class .

DataGridViewBand DataGridViewColumn
DataGridViewRow :
Displayed
Resizable
Visible
Tag
ErrorText
HasStyle

Frozen
ReadOnly
Selected
ValueType
ToolTipText
Style
InheritedStyle
AccessibilityObject
ContextMenuStrip

:
:ColumnIndex
.
:OwningColumn
DataGridViewColumn .
:RowIndex
.
:OwningRow
DataGridViewRow .
:Size
Size .

:PreferredSize
Size
.
:ContentBounds
Rectangle
..

.
:ErrorIconBounds
Rectangle
) (.
:DefaultNewRowValue
Object
) (.

.. :

..
...
:Value
..Object:
"DataGridView1.Rows(0).Cells(0).Value = "Test
:FormattedValue
Object ..
.
:FormattedValueType
Type .

:EditedFormattedValue

..
FormattedValue .
:
CellContentClick


DataGridViewChecBoxColumn
EditedFormattedValue
..Value
Focus
!!
:EditType
Type
.. :
DataGridViewTextBoxEditingControl
..
.DataGridViewComboBoxEditingControl
Override CalendarCell



DataGridColumnTypes
CalendarEditingControl
.DateTimePicker
:IsInEditMode
True .
:InheritedState
DataGridViewElementStates
.
:

:MeasureTextHeight
..
..
:
Graphics . . Font . ) (. TextFormatFlags :Default
Bottom
Top
Left
Right
RightToLeft
HorizontalCenter
VerticalCenter
EndEllipsis
PathEllipsis
ExpandTabs
ExternalLeading
HidePrefix
Internal
ModifyString
NoClipping
GlyphOverhang
Padding
NoPadding
LeftAndRight
Padding
NoPrefix

.
.
.
.
.
.
.
.

.
.
.

.
.
.
.

.

.
.
.
&

Characters
.

.
.XP
.
.
.

) (...
.
.
Mnemonic

NoFullWidth
CharacterBreak
PrefixOnly
SingleLine
TextBoxControl
WordBreak
WordEllipsis

PreserveGraphics
Clipping
PreserveGraphics
TranslateTransfor
m

) ( .

.Or

ByRef Output
True
.
:MeasureTextWidth
:
Graphics . . Font . . - TextFormatFlags .

:MeasureTextSize
Size
:
Graphics . . Font . TextFormatFlags . :MeasureTextPreferredSize
Size
:
Graphics . . Font . Single .
TextFormatFlags . :AdjustCellBorderStyle
DataGridViewRow.AdjustRowHeaderBorderStyle

.
:InitializeEditingControl

..
:
. Formatted Value .
DataGridViewCellStyle
.

Override CalendarCell
DataGridColumnTypes
.
:PositionEditingControl
:
Boolean True False
.
Boolean True False
.
Rectangle . Rectangle .
DataGridViewCellStyle . True .
True .
True .
True .
:PositionEditingPanel

..
..
Rectangle
.

:DetachEditingControl
.
:GetInheritedState
DataGridViewElementStates

.. .
:
InheritedState
Shared Row Index
- GetInheritedState
..


.
:GetContentBounds
Rectangle
.. .
:GetEditedFormattedValue

:
. DataGridViewDataErrorContexts :
Formatting .
Display
.
PreferredSize ..
.

RowDeletion ..


.
Parsing

.
Commit

.
InitialValue
Restoration
.
LeaveControl
.
CurrentCell
Change
.
Scroll

.
Clipboard

Clipboard
Content
.

.Or

:GetInheritedContextMenuStrip
ContextMenuStrip
..
.
:GetInheritedStyle
DataGridViewCellStyle
.. :
DataGridViewCellStyle .

. True .
:KeyEntersEditMode
True
KeyEventArgs
e ..KeyPress
Escape )
Cell (:
)Dim K As New KeyEventArgs(Keys.Escape
MsgBox(Cell.KeyEntersEditMode(K)) ' Fales
:ParseFormattedValue

:
Object . .DataGridViewCellStyle " " TypeConverter .. Nothing
.
" " TypeConverter .. Nothing
.

.


DataGridViewTextBoxCell Class
DataGridViewCell
.
:
:MaxInputLength
.
DataGridColumnTypes CalendarCell
DataGridViewTextBoxCell
DateTimePicker
..
.


DataGridViewButtonCell Class
DataGridViewCell .
:
:FlatStyle
:UseColumnTextForButtonValue

DataGridViewButtonColumn
.


IDataGridViewEditingCell Interface

.. :
:EditingCellValueChanged
True .
:EditingCellFormattedValue
.
:GetEditingCellFormattedValue
Object ..
DataGridViewDataErrorContexts
.
:PrepareEditingCellForEdit

True .







DataGridViewCheckBoxCell Class
DataGridViewCell
IDataGridViewEditingCell
.CheckBox
:
- .
- Boolean
.ThreeState

IDataGridViewEditingCell
DataGridViewCheckBoxColumn

:
FlatStyle
ThreeState
FalseValue
TrueValue
IndeterminateValue


DataGridViewImageCell Class
DataGridViewCell
.
:
- .
- Boolean
.ValuesAreIcons

DataGridViewImageColumn

:
Description
ImageLayout
ValueIsIcon







DataGridViewLinkCell Class
DataGridViewCell
.Link

DataGridViewLinkColumn

:
UseColumnTextForLinkValue

LinkBehavior
LinkColor
ActiveLinkColor
VisitedLinkColor
TrackVisitedState
:
:LinkVisited
True
..VisitedLinkColor
TrackVisitedState .True


DataGridViewComboBoxCell Class
DataGridViewCell
.ComboBox

DataGridViewCombokBoxColumn

:
AutoComplete
DataSource
DisplayMember
ValueMember
Sorted
Items
FlatStyle
DisplayStyle
DisplayStyleForCurrentCellOnly
MaxDropDownItems
DropDownWidth
:

.. :

.
DataGridViewComboBoxColumn
ComboBox
Edit Mode ..
:
DataGridViewComboBoxColumn.DataSource DataGridViewComboBoxColumn.DisplayMember

DataGridViewComboBoxColumn.ValueMember
.. DataGridViewComboBoxCell
DataSourceDisplayMember
..ValueMember
..
..DataGridViewComboBoxColumn.CellTemplate
..
.

GataGridView.CellValueChanged
)
( .. e.ColumnIndex
) ..
:(X
If e.ColumnIndex = X Then

End If
:
e.RowIndex:)Dim Row = DataGridView1.Rows(e.RowIndex
X:)Dim Cell = Row(e.RowIndex).Cells(X
Value ) ValueMember ID
(:
)Dim GovID = CType(Cell.Value, Integer
.. ..Cities
) .(X + 1
..



DataGridViewCell

DataGridViewComboBoxCell
:
= Dim CityCell As DataGridViewComboBoxCell

)Row.Cells(X + 1
CityCell.DataSource = Cities
"CityCell.DisplayMember = "Name
"CityCell.ValueMember = "ID

.

CellTemplate
..
)
(!

SortMode .. Sorted

!

..
CellTemplate
..
.
DataGridView.CellEnter
.


IDataGridViewEditingControl Interface

:
:EditingControlDataGridView
DataGridView
.
:EditingControlFormattedValue
.
:EditingControlRowIndex
.
:EditingControlValueChanged
True
.
:EditingPanelCursor
Cursor
Panel .

:RepositionEditingControlOnValueChange
True
.. :
.
:

:ApplyCellStyleToEditingControl

DataGridViewCellStyle .
:EditingControlWantsInputKey
True
..
False
.. :
Keys .
True .
:GetEditingControlFormattedValue

DataGridViewDataErrorContexts
.
:PrepareEditingControlForEdit

True .
CalendarEditingControl



DataGridColumnTypes
IDataGridViewEditingControl
..
:DateTimePicker
Class CalendarEditingControl
Inherits DateTimePicker
Implements IDataGridViewEditingControl
'
' IDataGridViewEditingControl
End Class


DataGridViewTextBoxEditingControl
TextBox
IDataGridViewEditingControl

.

.IDataGridViewEditingControl


DataGridViewComboBoxEditingControl Class
ComboBox
IDataGridViewEditingControl

.

.IDataGridViewEditingControl






DataGridViewHeaderCell Class
DataGridViewCell
.
..


DataGridViewHeaderCell
.


DataGridViewColumnHeaderCell
DataGridViewHeaderCell
.
:
:SortGlyphDirection
Glyph
SortOrder:
None
) (.
Ascending ) (.
Descending ) (.


DataGridViewTopLeftHeaderCell
DataGridViewColumnHeaderCell

.
.


DataGridViewRowHeaderCell
DataGridViewHeaderCell
.
.





DataGridViewCellStyle Class
ICloneable
.
:
- .
- DataGridViewCellStyle
.
:
BackColor
Font

Padding
ForeColor
Tag
:

:Alignment

DataGridViewContentAlignment:
NotSet
.
TopLeft
.
TopCenter .
TopRight
.
MiddleLeft .
MiddleCenter .
MiddleRight .
BottomLeft .
BottomCenter .
BottomRight .

:Format
..
.
:FormatProvider
IFormatProvider
CultureInfo
..
.
:IsFormatProviderDefault
True FormatProvider
False .
:DataSourceNullValue

..
.DbNull

:IsDataSourceNullValueDefault
True DataSourceNullValue
False .

:NullValue
Object
..DbNull

..:
"Gdv.Columns(0).DefaultCellStyle.NullValue = "....
" "...
" "...
) (.

Ctrl+0 ..

..
"".
:IsNullValueDefault
True NullValue False
.
:SelectionBackColor
.Selected Cell
:SelectionForeColor
.
:WrapMode

DataGridViewTriState
.
:
:ApplyStyle
DataGridViewCellStyle
.


DataGridViewAdvancedBorderStyle Class
ICloneable
.
:
:All

DataGridViewAdvancedCellBorderStyle:
NotSet
.
None
.
Single
.
Inset
.
InsetDouble .
Outset
.
OutsetDouble .
OutsetPartial .
:Top
.
:Bottom
.
:Left
.
:Right
.

DataGrid

.DataGridView
DataGridView

:
- Styles
.
-
Access +
..
DataGridView



..DataGridViewAuthorBooks

.DataGridViewMasterDetails


DataGrid .DataGridView

Data Choose Items
DataGrid

System.Windows.Forms
.


IdataGridEditingService Interface

:
:BeginEdit
:
DataGridColumnStyle .
. True .
:EndEdit
:
DataGridColumnStyle .
. True .. False
.
True False
.





DataGridTableStyle Class
Component IdataGridEditingService
DataGrid
.
:
- .
- True
.
- CurrencyManager

.
:DataGrid
DataGrid .
:MappingName


" .."Authors

.
:GridColumnStyles
GridColumnStylesCollection
BaseCollection ..IList
DataGridColumnStyle
..
DataGridColumnStyle.
:ColumnHeadersVisible
) True (
.
:RowHeadersVisible

) True (
.
:PreferredColumnWidth

.
:PreferredRowHeight

.
:RowHeaderWidth
.
:ReadOnly
True
.
:AllowSorting
True
.
:BackColor
.
:AlternatingBackColor
.
:ForeColor
.
:SelectionBackColor
.

:SelectionForeColor
.
:GridLineColor
.
:GridLineStyle

DataGridLineStyle:
None .
Solid .
:HeaderBackColor
.
:HeaderForeColor
.
:HeaderFont
.
:LinkColor
Links .
:LinkHoverColor
Links
.
Reset

.ResetBackColor

RowHeaderWidthChanged
.

IDataGridColumnStyleEditingNotificationService Interface

:
:ColumnStartedEditing

Control .

DataGridColumnStyle
Abstract Base Class




Component

..IDataGridColumnStyleEditingNotificationService

.
:
:DataGridTableStyle
DataGridTableStyle
.
:Alignment

HorizontalAlignment Left : Right .Center
:HeaderText
.
:MappingName
Data Member ..
.

:NullText
.
:ReadOnly
True
.False
:Width
.
:PropertyDescriptor
PropertyDescriptor
.. .
:
:ResetHeaderText
HeaderText "".
:
:WidthChanged
.

DataGridTextBoxColumn Class
DataGridColumnStyle
.
:
- .
- PropertyDescriptor
.
- True
.Default Column
-
.
-
True .Default Column
:
:Format
.
:FormatInfo
IFormatProvider
CultureInfo
..
.
:TextBox
TextBox
.

DataGridBoolColumn Class
DataGridColumnStyle
CheckBox .Boolean
:
- .
- PropertyDescriptor
.
- True
.Default Column
:
:AllowNull
False :
Checked ..Unchecked True

Indeterminate .DbNull
:NullValue

.. -
.
:FalseValue
False
..Unchecked
.
:TrueValue
True
..Checked
.


DataGridCell Structure
:
. . :
:RowNumber
.

:ColumnNumber
.






DataGrid Class
Control
IdataGridEditingService :

:DataSource

DataSet DataTable
DataView
.
:DataMember

"."Authors
:TableStyles
GridTableStylesCollection
BaseCollection IList
.GridTableStyles


:

Add


..MappingName GridColumnStyles
..
:

..Add
Add

DataGridTextBoxColumn
..DataGridBoolColumn
.. MappingName
.

AutoFormat

.

:AllowNavigation
) True (
.
DataGridNavigation
..
" "+ .

AllowNavigation
+ !
..Authors

..
..NewDataSet
" ".

" .."+


..Relation1 " ":

AllowNavigation
+ .
..
:

..
.


:
DataGrid1.DataSource = Ds
:
)"DataGrid1.DataSource = Ds.Tables("Authors

+
.. :
)"DataGrid1.DataSource = Ds.Tables("Books

.
:BackgroundColor
) (.
:CaptionVisible
False
.. .True
:CaptionText
.
:CaptionBackColor
.
:CaptionForeColor
.
:CaptionFont
.

:CurrentRowIndex
.
:CurrentCell
DataGridCell .
:Item
.. :
- DataGridCell .
- .
:FirstVisibleColumn
.
:VisibleColumnCount
.
:VisibleRowCount
.
:FlatMode
True ..
.False
:ParentRowsVisible
) True (
.

:ParentRowsBackColor
.
:ParentRowsForeColor
.
:ParentRowsLabelStyle

DataGridParentRowsLabelStyle:
None
.
TableName .
ColumnName ) (.
Both
.
:
ColumnHeadersVisible
RowHeadersVisible
PreferredColumnWidth
PreferredRowHeight
RowHeaderWidth
ReadOnly
AllowSorting
BackColor
AlternatingBackColor
ForeColor
SelectionBackColor
SelectionForeColor
GridLineColor
GridLineStyle
HeaderBackColor
HeaderForeColor

HeaderFont
LinkColor
LinkHoverColor

DataGridTableStyle ..


.
:
:Expand

) + ( ..
.
- :
)DataGrid1.Expand(-1
Expand DataGridNavigation

.

AllowNavigation +
Expand
.

:IsExpanded
True ..
.-
:Collapse

) - ( ..
.
- :
)DataGrid1.Collapse (-1
Collapse DataGridNavigation

.
:GetCellBounds
Rectangle
.. :
- .DataGridCell
- .
:GetCurrentCellBounds
Rectangle
.
:IsSelected
True .
:Select
Control
) (Focus
.
:UnSelect
.

:ResetSelection
.
:NavigateBack

.. :
..
..
..
NavigateBack .DataGridNavigation
:NavigateTo

..


..NavigateBack
NavigateTo .DataGridNavigation
:SetDataBinding
:
.Data Source . :HitTest
HitTestInfo

Point X .Y
HitTestInfo DataGrid
:
Nowhere

Column

HitTestInfo

)
(.
.

Row
Type

DataGrid.HitTestType
..
:
:None . :Cell. :ColumnHeader . :RowHeader . :ColumnResize .
:RowResize .
:Caption .


:ParentRows .

:
:CurrentCellChanged
.
:BackButtonClick

.
:Navigate
.. e
NavigateEventArgs Forward
True ) (.
:ShowParentDetailsButtonClick


.
:Scroll
.
DataGrid
DataGridView




!


Data Repeater

List
..

:



..
.
..
..
Template ..
DataRepeater
ContainerControl ..
.
:
) Repeater (. Authors Books .Countries
Country Expression :
Parent.Name
.
Visual Basic PowerPacks DataRepeater
.
..

.

: - :Item Template

..

..

Data Sources ..



..
.
- :Viewport

..
..
..

..
Anchor

.
Data Sources Window Authors Details
.. Country
ComboBox
..
.. CountryID
.
.
.. :
!! ..
!! ..

!! ..
) Items (

! ..
.. :
For Each R As BooksDataSet.CountriesRow In
BooksDataSet.Countries.Rows
)CountryComboBox.Items.Add(R.Name
Next

!!


..

.. Template ..

..
!

BeginResetItemTemplate EndResetItemTemplate .

DropDownList ..DropDownStyle

..
Text Author.Country
..
Text
.

..

!

..
.

DataRepeater Class
Microsoft.VisualBasic.PowerPacks
.ContainerControl
:
:AllowUserToAddItems
) True (


) (
CTRL+N .

..

..
.
False
CTRL+N
.
:AllowUserToDeleteItems
) True (

DELETE .
:ItemCount
.

Virtual Mode
..
.
:ItemTemplate

DataRepeaterItem
.. DataRepeaterItem .
..

F4 ..

..
Viewport
.
:CurrentItem
DataRepeaterItem
..
.. .
..Items

Controls
..:
)Dim Itm As DataRepeaterItem = DataRepeater1.Controls(0

:
For Each Itm As DataRepeaterItem In
DataRepeater1.Controls
)Msgbox(Itm.ItemIndex
Next
:
Imports Microsoft.VisualBasic.PowerPacks

!! ..

..
DrawItem
.
:CurrentItemIndex

..
.. :
DataRepeater1.CurrentItemIndex = 1
:DisplayedItemCount

.. True
:
))MsgBox(DataRepeater1.DisplayedItemCount(True
False :
))MsgBox(DataRepeater1.DisplayedItemCount(False
:FirstDisplayedItemIndex
.
:ItemHeaderVisible
False
.. .True
:ItemHeaderSize
.
:SelectionColor
.
:LayoutStyle

DataRepeaterLayoutStyles:
Vertical ) (
.. .
Horizontal ) (
..
.RepeaterItemColor
:

:AddNew
..
AllowUserToAddItems .False
:RemoveAt
.
:CancelEdit

..
Esc
.. KeyDown

..Esc
UserCancelsEdit Repaeter
KeyDown
:
If e.KeyCode = Keys.Escape Then
) (DataRepeater1.CancelEdit
End If


.. ESC
..
ESC !
:ScrollItemIntoView

.
True

.
:BeginResetItemTemplate

:
..

ItemTemplate
BeginResetItemTemplate
.
:EndResetItemTemplate


..
" " :Repeater
) (DataRepeater1.BeginResetItemTemplate
CountryComboBox.BackColor = Color.Yellow
) (DataRepeater1.EndResetItemTemplate
'
.. .
:
:CurrentItemIndexChanged
CurrentItemIndex
.
:DataError

.. e
DataRepeaterDataErrorEventArgs :
DataRepeater
DataRepeaterItem
Item
.
Control
.
PropertyName ..
: .
Exception
Exception

.
ThrowException True

.. .False
:UserAddedItems
CTRL+N
.. e
DataRepeaterAddRemoveItemsEventArgs :
ItemIndex .
ItemCount .



.. Repeater
.RepeaterItemColor
:DeletingItems

.. e
DataRepeaterAddRemoveItemsCancelEventArgs
Cancel
True ..
:
", "(If MsgBox
MsgBoxStyle.OkCancel) = MsgBoxResult.Cancel Then

e.Cancel = True
End If

..
DeleteItem
Nothing :
Dim I = DataRepeater1.CurrentItem.ItemIndex

)DataRepeater1.RemoveAt(I
.Repeater
:UserDeletingItems

Delete
.
:UserDeletedItems

.. e
DataRepeaterAddRemoveItemsEventArgs
..
.e.Cancel
:ItemCloning
.. e
DataRepeaterItemCloneEventArgs
:
Source DataRepeaterItem
.
Target
DataRepeaterItem ..

.
Handled True
..

Source
.Target
:ItemCloned
.. e
DataRepeaterItemEventArgs
DataRepeaterItem ..


! ..
..

.
:DrawItem
..

.
e DataRepeaterItemEventArgs
.


..
RepeaterItemColor :
- :
If e.DataRepeaterItem.ItemIndex Mod 2 = 0 Then
e.DataRepeaterItem.BackColor = Color.Green
Else
e.DataRepeaterItem.BackColor = Color.Yellow
End If

-
DataView
..


..

..

:
If BksLst.DataSource Is Nothing Then
BksLst.DataSource = BooksView
"BksLst.DisplayMember = "Book
End If



..


! ..

!

..
..
IDTextBox :
= Dim AuthorID As Integer
Itm.Controls("IDTextBox").Text
If AuthorID < 0 Then Exit Sub

DoubleClick
..

:
FrmBooks.GrdBooks.DataSource = BksLst.DataSource
BooksList

.. .






:
ListView
DataGridView ..
..

.
VirtualRepeater

..

.


:
:VirtualMode
True
.. ..False
VirtualRepeater
..True ItemCount


:
DataRepeater1.ItemCount = BooksDataSet.Authors.Count


..
Binding
!! ..
.
:ItemValueNeeded

..
..
.. e
DataRepeaterItemValueEventArgs :
ItemIndex .
Control .
Property
Name
) (.
Value

..

.. :

IDTextBox
! ..
" "
! .. Text
e.Value
! ..
ToString
.
VirtualRepeater
.. Select
..


.. :
Dim Authors = BooksDataSet.Authors
Select Case e.Control.Name
"Case "IDTextBox
e.Value =Authors(e.ItemIndex).ID.ToString
"Case "AuthorTextBox
e.Value =Authors(e.ItemIndex).Author
End Select
DbNull
Try Catch ..
.VirtualRepeater
ItemValueNeeded
DrawItem ..
View Object
:
Dim Itm = e.DataRepeaterItem
Dim Authors = BooksDataSet.Authors
'
)Dim Rv = Authors.DefaultView(Itm.ItemIndex
)Dim Rl = BooksDataSet.Authors.ChildRelations(0
'
(Dim GrdBooks = CType(Itm.Controls
)"BooksDataGridView"), DataGridView
'
'
)GrdBooks.DataSource = Rv.CreateChildView(Rl

:NewItemNeeded

..CTRL+N
..
VirtualRepeater
:
Dim R = BooksDataSet.Authors.NewAuthorsRow
" " = R.Author
R.CountryID = 12
)BooksDataSet.Authors.AddAuthorsRow(R

..
..
Trim
.ItemValueNeeded
:ItemsAdded

.. e
DataRepeaterAddRemoveItemsEventArgs
.. :
.NewItemNeeded .ItemValueNeeded .DrawItem .ItemsAdded :ItemValuePushed

..
..

.. :
- MaxLength
..
.

- True ReadOnly
ID .
- KeyPress
.
- DateTimePicker
..

.
-
.. .
- MaskedTextBox
) (.

.

DataRepeaterItemValueEventArgs .ItemValueNeeded
:IsCurrentItemDirty
True
..
.
:ItemsRemoved

.. e
DataRepeaterAddRemoveItemsEventArgs
.. VirtualRepeater
:
)BooksDataSet.Authors.Rows.RemoveAt(e.ItemIndex
..
:
(Dim Fkc As New ForeignKeyConstraint
BooksDataSet.Authors.IDColumn,
)BooksDataSet.Books.AuthorIDColumn
Fkc.UpdateRule = Rule.Cascade

Fkc.AcceptRejectRule = Rule.Cascade
Fkc.DeleteRule = Rule.Cascade
)BooksDataSet.Books.Constraints.Add(Fkc


..
..

AuthorID .






DataRepeaterItem Class
Panel

)( .

:
:IsCurrent
True ) (
.
:IsDirty
True
.
:ItemIndex
.
..
Panel
Controls
..

..

..


.. Name
.. :
:
"AuthorTextBox.Text = "Test


BeginResetItemTemplate

EndResetItemTemplate .
:
Dim Itm = DataRepeater1.CurrentItem
(Dim AutherTxtBx = CType
)Itm.Controls("AuthorTextBox"), TextBox
"AutherTxtBx.Text = "Test
RepeaterItemColor
:
)"Dim BksLst As ListBox = Itm.Controls("BooksList
BksLst.DataSource = BooksView
"BksLst.DisplayMember = "Book

:
Dim Itm = DataRepeater1.CurrentItem
'
)Dim Rv = BooksDataSet.Authors.DefaultView(Itm.ItemIndex

'
)Dim Rl = BooksDataSet.Authors.ChildRelations(0
)Dim BooksView = Rv.CreateChildView(Rl
'
FrmBooks.GrdBooks.DataSource = BooksView
& " " = FrmBooks.Text
Itm.Controls("AuthorTextBox").Text
) (FrmBooks.ShowDialog
..
..

.

:

..
:
.Transactions .LinQ To SQL .Entity Framework .Managed Stored Procedures
.Crystal Reports " " .


Managed SQL Data Types

System.Data.SqlTypes Structures
Classes ..
.
..
:
Imports System.Data.SqlTypes
.SqlDataTypes
SqlDataReader
Methods
..
SqlDataReader.GetSqlDecimal
..SqlDecimal
.
INullable
Null
..
IsNull True ) (Null
.

SqlBoolean Structure
True : .False
:
. .Null
. Boolean ..:
)Dim Sb As New SqlBoolean(True
. Integer
False .True
:
:False
SqlBoolean .False
:True
SqlBoolean .True
:Null
SqlBoolean .Null
:Zero
SqlBoolean ) .(False
:One
SqlBoolean ) .(True
:IsFalse
True .False
:IsTrue
True .True

:Value
Boolean ..

IsNull .
:ByteValue
Byte )
( ..
IsNull ..:
If Not Sb.IsNull Then
MsgBox(Sb.ByteValue) ' 1
MsgBox(Sb.Value) ' True
End If
Operators
.. Shared Methods
..
:

And
And
Or
Or
Xor
Xor
OnesComplement
Not
) (
Equals
=
NotEquals
><
GreaterThan
>
=> GreaterThanOrEquals
LessThan
<
LessThanOrEquals
=<
:
ToSqlByte
ToString
ToSqlDouble
ToSqlDecimal
ToSqlInt32
ToSqlInt16

ToSqlMoney
ToSqlString

ToSqlInt64
ToSqlSingle
Parse
:

)"Dim Sb = SqlBoolean.Parse("false
Dim B As SqlByte = Sb.ToSqlByte
MsgBox(B.ToString) ' 0

Implicit Operators
Explicit Operators
..:
"Dim Sb1 As SqlBoolean = "true
Dim B1 As SqlByte = Sb1
MsgBox(B1.ToString) ' 1
:

) (
) And Or Xor (Not ..

) (
.

SqlByte Structure

.
Byte ..:
)Dim B As New SqlByte (5
:
:MinValue
.
:MaxValue
.
:Zero
SqlByte .
:Null
SqlByte .
:Value
Byte ..

IsNull .
SqlByte
Null
..
:

SqlInt16 Structure
SqlInt32 Structure
SqlInt64 Structure
SqlSingle Structure
SqlMoney Structure
SqlDouble Structure
SqlDateTime Structure
SqlGuid Structure

SqlDecimal Structure
Decimal
Decimal
.
:
:MaxPrecision
.
:MaxScale
.
:BinData
Byte Array .
:Data
Integer Array
.
:IsPositive
True .

:Precision
.
:Scale
.

SqlChars Class

varchar, nvarchar, char, nchar, text, ntext :

) (.
:
. .Null
. .Char Array
. SqlString
.
:
:Null
.SqlChars
:Item
Default Property
.
:Length
.

:MaxLength
..
..
.
:Storage
StorageState
:
Buffer
.
UnmanagedBuffer
.
.Stream
Stream
:Buffer
..
.
:Value
..

.Buffer
:
:SetLength
..
MaxLength ..



.
Unmanaged Buffer
Managed Buffer .
:SetNull
.

:Read

:
. . . . ..

.
:
)"Dim Sc As New SqlChars("This is a test
Dim C(4) As Char
)Sc.Read(3, C, 0, 5
)"'" & MsgBox("'" & C
:Write

.. .

.MaxLength
:
)"Dim Sc As New SqlChars("This is a test
}Dim X() As Char = {"A"c, "B"c, "C"c, "D"c, "E"c
)Sc.Write(3, X, 0, 5
)MsgBox(Sc.Value
:ToSqlString
SqlString
.

SqlString Structure
String Class
.. :

..
LCID

.
) Globalization (.
:
. .Null
. String .
.
LCID ..:
", System.Globalization."(Dim Ss As New SqlString
)CultureInfo.CurrentCulture.LCID

.
SqlCompareOptions:
None

.
IgnoreCase
.
IgnoreNonSpace

..
.
IgnoreKanaType
.
IgnoreWidth

.

BinarySort
ASCII Unicode .
BinarySort2
.
.
.
.
.

.Or
LCID
SqlCompareOptions Byte Array
.
True
.Unicode


.
True
.Unicode

:
:BinarySort

ASCII .
:BinarySort2
.
:IgnoreCase
) (.
:IgnoreNonSpace

.

:IgnoreKanaType

.
:IgnoreWidth

.
:Null
.SqlString
:CultureInfo
CultureInfo
.
:LCID
.
:CompareInfo
CompareInfo
.
:SqlCompareOptions
SqlCompareOptions
.
:Value
String
.
:

:Concat
..:
Dim LCID = System.Globalization.
)CultureInfo.CurrentCulture.LCID

)", LCID"(Dim Ss1 As New SqlString


)", LCID "(Dim Ss2 As New SqlString
)Dim Ss3 = SqlString.Concat(Ss1, Ss2
' )MsgBox(Ss3.Value
Add:
)Dim Ss3 = SqlString.Add(Ss1, Ss2
:
Dim Ss3 = Ss1 + Ss2




:CompareOptionsFromSqlCompareOptions
SqlCompareOptions
CompareOptions
.
:Clone
SqlString .
:GetNonUnicodeBytes
Bytes Array
.ASCII
:GetUnicodeBytes
Bytes Array
.Unicode

SqlBinary Structure
..Byte Array
..:
)}Dim Sb1 As New SqlBinary({100, 220, 3
Implicit Operator
:
}Dim Sb2 As SqlBinary = {1, 0, 2
:
:Null
..:
Dim Sb3 = SqlBinary.Null
:Length
..:
MsgBox(Sb1.Length) ' 3
:Item
Default Property
Byte ..:
MsgBox(Sb1.Item(0)) ' 100
MsgBox(Sb1(1)) ' 220

..
!
:Value
Byte Array
.
Shared
Operators ..
:

:Add
:Concat
: +

..:
)Dim Sb = SqlBinary.Add(Sb1, Sb2
:
)Dim Sb = SqlBinary.Concat(Sb1, Sb2
:
Dim Sb = Sb1 + Sb2
Sb :
.
:Equals
= :
True
..:
MsgBox(SqlBinary.Equals(Sb1,Sb2)) ' False
:

MsgBox(Sb1 = Sb2) ' False


SqlBollean
Null .

SqlBytes Class
SqlBinary
Bytes
..Stream FileStream
MemoryStream .NetworkStream
:
. .
. .Byte Array
. .SqlBinary
. .Stream
SqlChars
Byte Array
..Char Array :
IsNull
Null
Length
Item
Storage
MaxLength
Value
Buffer
SetNull
SetLength
Write
Read
:
:Stream
..


.OutOfMemoryException
:ToSqlBinary
SqlBinary Bytes
.

XML
SqlXml Class
XML " "XML
XmlReader XML
..XmlReader
XML .
:
- .
- .Stream
- " .XmlReader "XML
:
:Null
SqlXml .
:Value
String XML .
:
:CreateReader
" XmlReader "XML
.
:
XML :
IXmlSerializable XML .
Shared Method GetXsdType " XmlSchemaSet "XML
XmlQualifiedName XML.


) BLOB (
) varbinary(MAX
.. :
- .
- .
- ) varbinary(MAX

!
-

.Windows File System
-
SqlFileStream .

.. :
- FILESTREAM :
:
Programs Menu:\Microsoft SQL Server 2008\Configuration Tools
SQL Server Configuration Manager
SQL Server Services .
.. ) SQL Server(SQLEXPRESS
.
Tab FILESTREAM .
:Enable FILESTREAM for Transact-SQL access
.

:Enable FILESTREAM for file I/O streaming access



Sharing ..

..SqlFileStream
..
SQLEXPRESS
.
:Allow remote clients to have streaming access to FILESTREAM

Remote Users
.

:
SqlFileStream

..
Sharing
:
Enable FILESTREAM for file I/O streaming access
:
Windows Explorer Tools .Folder Options
View
:
Use simple file sharing.
Ok . FileStream
FileStream
Restart
..
.
Ok . - FILESTREAM :
SQL Server Management Studio
Object Browser )
(SQLEXPRESS
..Properties
.. Advanced
:

Filestream Access Level


.. Disabled
! ..
..Full Access Enabled
..
:



SQL

..Transact-SQL Access Enabled Ok ..



..Restart
SQL Server Configuration Manager .
- FILESTREAM :
T-SQL
) FILESTREAM ( ..

..SQL Server Management Studio

..
:
Object Explorer . Attach C:\Books.mdf . .Properties

FileGroups .. :
. )
( ..
.
. ..Filestream
.. Add
FILESTREAM
Default .
Files Add .
..BooksFiles .

File
Type ..FILESTREAM FileGroup
FILESTREAM.
Path ..
NTFS .FAT32
Ok .. BooksFiles ..
Data Container ..Filegroup :
- .
-
Compressed Volume .
-
..

.
- Update Delete
Insert SQL


.
- UPDATE .Write
..
SqlFileStream
.
- FILESTREAM :
) (
..

..T-SQL :
BOOKS.MDF .New Query
:ALTER TABLE Publishers
ADD Logo3 VARBINARY(MAX) FILESTREAM NULL,

RowGuid UNIQUEIDENTIFIER
NOT NULL ROWGUIDCOL
)(UNIQUE DEFAULT NEWID

GO
Publishers :
. Logo3 )VARBINARY(MAX
FILESTREAM
.NULL
. RowGuid
UNIQUEIDENTIFIER NOT NULL
..ROWGUIDCOL


.Null

..Execute
.

Publishers Logo3
.
Logo3
:
UPDATE Publishers
SET Logo3 = @Logo
WHERE ID = 1
Write to FileStream
WriteLargeData ..
..OK BooksFiles
..

) .bmp( .


.BooksFiles
:
SELECT ID, Logo3
FROM Publishers
Sequential
DataReader ..
image
) ..varbinary(MAX Read FileStream
ReadLargeData
\ C: .Logo1.bmp
..
..
..SqlFileStream .

SqlFileStream Class
Stream
) ( ..

.FILESTREAM
:
- :
.. SQL ) ( .PathName
.
Byte Array ..Transaction Context


SQL
..GET_FILESTREAM_TRANSACTION_CONTEXT
Nothing ..
..Transaction

Commit Transactions
FileAccess : Read Write
.ReadWrite
- :
FileOptions ..
SequentialScan

RandomAccess
.
..
.


:
:Name
.
:TransactionContext
.
SqlFileStream.Read
..ReadLargeData :
SELECT ID, Logo3.PathName( ),
) ( GET_FILESTREAM_TRANSACTION_CONTEXT
From Publishers
:
Transaction Context ..

.C:
Logo3
SqlFileStream.Write
..WriteLargeData
Null
:
UPDATE Publishers
SET Logo3 = 0x0
;Where ID = 2
SELECT Logo3.PathName( ),
) ( GET_FILESTREAM_TRANSACTION_CONTEXT
From Publishers
Where ID = 2

PathName Null
..SqlFileStream ..0x0

..
.

SqlFileStream.Seek
:
)SqlFileStream.Seek(0, SeekOrigin.End
0x0
.



.. :
- .Net Frame work :
..

..dotNetFx : .
- :

SQL Server )
(Local Server

IP
) ( ..
)
(Connection String

IP .
SQL Server Express
.
- :
Report Viewer
Crystal Report
..
Report Viewer :
Microsoft Report Viewer 2012 Runtime



..SQLSysClrTypes .
- :

..

)
( .

Registry
Setup Package ..
"
".
:



.

)
( ..


.

SQL Server Express


SQL Server Express

..




.
..
) ( !

..
:
. .

.


..

) (
) (.
:
.
SQL Server Express

.

J

Microsoft SQL Server Express


) ( .

:

.
..

.

:
: msvbnet@hotmail.com
: http://mhmdhmdy.blogspot.com
:( ) http://www.youtube.com/user/mhmdhmdy
: https://www.facebook.com/Poet.Mhmd.Hmdy
: http://mhmdhmdy.blogspot.com/2010/09/blog-post_9555.html
: https://www.facebook.com/vbandcsharp
:
: -
http://www.kutub.info/library/author/%%
:" " : -
http://mhmdhmdy.blogspot.com/2013/11/blog-post_29.html
:( ) -
http://www.mediafire.com/?n1qte7j9hdv1l98
:( ) -
http://www.mediafire.com/download/gzivkgedtvx2e4j/Pain_Cup.pdf

: " -
http://www.mediafire.com/?hd1jy6ca4ay3m9w
:"( " )-
http://mhmdhmdy.blogspot.com.eg/2015/11/blog-post_39.html

:
. :
.
. : .
. : .
. : .
. : .
. : .
. : .
. : .

. : .
.

.
.

WPF .

WPF .

:
http://mhmdhmdy.blogspot.com/2010/09/blog-post_9555.html


:
.Entity Framework - Report Viewer .Crystal Reports

.ASP.NET MVC . - .WPF

Windows Universal Applications

:
https://www.facebook.com/vbandcsharp