In this article I demonstration on Dis Connected Architecture.

Agenda :-
1)     difference between Connected Architecture and Disconnected Architecture
2)    Data Reader and DataSet.
3)    Feature of DataSet
4)    Working with DataSet
5)    Methods of DataAdapter.
6)    Accessing Data From DataSet.
7)    DataTable
8)    Referring to a cell under DataTable.




Lets we start with Details

 ADO.NET Provide two different models for accessing data from Data Source.
 1)Connection Oriented Architecture :-
2)Dis-Connection Oriented Architecture :-
1)Connection Oriented Architecture :-
                                      In this case we require a continuous connection with the Data Source for accessing data in it.
                 Here “DataReader”  Class is use for holding data on Client Machines.
2)Dis-Connection Oriented Architecture :-
                                      In this case we do not  require a continuous connection with the Data Source for accessing data .
                 Here “DataSet”  Class is use for holding data on Client Machines.

DataSet :-
                It is a class present under “System.Data” namespace design for holding and managing data on client machines apart from DataReader.
 Features Of DataSet:-
    1)it is also capable of  holding multiple tables.
   2)it is a designed Dis-Connected  architecture,which doesn’t  require any permanent connection with DataSource for holding data.
3)It Provide  scrollable navigation to data,that allows us to move in any direction.
i.e. eighter top to bottom or bottom to top.
4)it is updatable i.e . changes can be performed to data present in it and also send changes back to DB.
 Working With DataSet :-
                      This class that is responsible for loading of data into a DataReader from DataSource is command.
        In the same way,DataAdapter is the class used for Communication between DataSource and DataSet.
      Simply
  DataReader   < -  Command  -> DataSource.
DataSet          <->DataAdapter  <->DataSource.
 
Methods of DataAdapter :-
1)    Fill(DataSet ds,string TableName).
2)    Update (DataSet ds,string TableName)
   Fill is the method to Load data from DataSource into DataSet.
   Update is to transfer data from a DataSet to DataSource.
DataAdapter is internally collection of 4 Method:-
1)Select Command.
2)Insert Command.
3)Update Command.
4)Delete Command.
      When we call Fill() method of Adaper,Following action take place internally.
1)Open  a connection with DataSource.
2)Execute the Select   command under it on the DataSource and loads data from table to DataSet.
3)Close the Connection.

  As a DataSet is updatable ,changes can be made to data that is loaded into it like adding ,modifying and deleting records.
   After making all the changes to data in dataset and if we want to send those changes back to datasource  call Update ( ) method on dataadapter which perform following,
1)Re Open a Connection with DataSource.
2)Changes that are made in dataset will be sent back to table where in this process it will make use of insert,update and delete command of DataAdapter.
3)Close the Connection.
Accessing Data From DataSet:-
                          DataReader provides us Pointer vases access to th data ,so we can get data only in a sequencial order,where as dataset provides us index based access to data so we can get the data from any location .
                                           Dataset is a collection of table where each table is the represented as class datatable and identified by the index position .
DataTable :-
                            Datatable is the collection of tables.
Following syntax is used for DataTable
<DataSet>.Tables[Index]/[Name]
            Eg
Ds.Tables[0]
            Or
Ds.tables[“Company”]

Every DataTable is again Collection of Rows and Columns  where each row is represented as a class DataRow and identified by its index position.
     Each column is represented as class DataColumn and identified  by  it index position or Name.


DataRow:
   It is collection rows .
Syntax:
<datatable>.Rows[Index].
Eg.
Ds.tables[0].rows[0]
DataColumns:
   It is collection Coumns .
Syntax:
<datatable>.Columns[Index] OR  columns[Name]
Eg.
Ds.Tables[0].Column[0]
            OR
Ds.Tables[0].Column[“ENO”]
Ds.tables[0].rows[0]
Referring to a Cell under Data Table:
Syntax:
<datatable>.Rows[row] [col]
Eg.
Ds.Tables[0].Rows[0][0]
            OR
Ds.Tables[0].Rows[0][“ENO”]
Ds.tables[0].rows[0]


For more artical visit my blog

http://dotnetbyabhipatil.blogspot.in

0 comments:

Post a Comment

Rate me

Free Rating Code
 
Top
How to Become Author of TechFusion || write your suggestion and idea on comment box, we try to implement it.