Download presentation
Presentation is loading. Please wait.
Published byMarvin Greer Modified over 9 years ago
1
1 Data Classes- DataView DataGridView Control
2
Objectives 2 Data Class DataAdapter DataReader DataSet DataTable DataView DataGridView Control Summary
3
DataAdapter Properties 3
4
Demo 4 SqlDataAdapter is the best way to load data from server to DataSet
5
SqlDataAdapter : properties - Events 5 SqlDataAdapter dataAdapt = new SqlDataAdapter(); SqlCommand cmd = new SqlCommand(“Select * from authors”, con); dataAdapt.SelectCommand = cmd ; DataSet ds = new DataSet(); dataAdapt.Fill(ds); DeleteComman d InsertComman d SelectComman d UpdateComman d RowUpdate RowUpdating
6
OleDbDataAdapter 6 Used to connect to multiple databses such as : SQLServer, Access, Oracle Exists in the namespace : System.Data.OleDb Have the same properties and events as SqlDataAdapter
7
SqlDataReader class 7 Used to read data from SQL Server in a sequential manner and have some properties : Forward-only - Read Only Get it by call the ExecuteReader() method of SqlCommand object Read data by Read() method FieldCount HasRow IsClosed Item RecordsAffe cted
8
SqlDataReader : Method 8
9
DataSet 9 A representation of a database in cached-memory Included datatable and relation and contrains Ex : DataSet ds = new DataSet()
10
Method – Kind of DataSet 10 TypeDataSet : -Have a schema :.xsd UntypeDataSet : -Create by a code : DataSet A = new DataSet() Navigate Record : Using Binding source class and use some methods of this class as : - MoveFirst - MoveLast - MoveNext - MovePrevious
11
DataSet and XML 11 DataSet can fetch data from a XML file ReadXML(string path) : read XML file to DataSet WriteXML(string path) : save the content DataSet to a XML file
12
DataTable class 12 Represent a table in DataSet Have a constraint objects that ensure data integrity Properties
13
Method 13
14
DataTable: Event 14
15
DataTableCollection 15 The DataTableCollection class is a collection of the tables in DataSet Collection of the DataTable class
16
DataRelation 16 Maintains referential integrity by enforcing foreign-key constraint Unique constraint Cascade update and delete operation Use to relate two DataColumn Object that exits in two DataTable
17
DataColumn class 17 Used for creating a schema for a particular column You can add a column to a DataColumnCollection
18
DataRow class 18 Represent a row in a DataTable
19
DataTableReader 19
20
DataTableReader 20 DataTableReader dtr = dataTable.CreateDataReader()
21
Demo 21
22
Summary 22 Data Class DataAdapter DataReader DataSet DataTable
23
DataView class 23 Used to sort, filter, search, modify and navigate through the record Constructor of this class is a dataTable
24
Properties 24
25
25
26
DataViewManager 26
27
DataGrid control 27 Display data in a tabular format Populated by the table present in dataSet ( binding) Insert, delete, update DataSet
28
DataGridView control 28
29
DataGridView control 29
30
Example 30
31
DataGridView & DataGrid control 31
32
Summary 32
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.