MCQs Test!! VB Basic Test !! Essentials of VB !! Creating User Services !! function !! Anatomy !! GK March-2019 !! DATA TYPES IN JAVA !! Classes ,Constructor ,Methods,Inheritance !! Ecology-I !! Biology 2019 !! Gk april 2019 !! Biology (living world) !! Plant anatomy !! CELL STRUCTURES AND FUNCTION !! General biology !! Human physiology !! Data structure !! Ecology-II !! GK TEST !! Reproduction in plants !! Human reproduction !! The ABC of C !! Operating system set1 !! Operating system set2 !! Gk and current affairs !! Animal kingdom !! Number system !! Animal kingdom-II !! Gk TEST-III !! Number series !! Microorganisms !! Interview question in c !! Time and Work !! Percentage !! General history !! Average !! Cells !! Locomotion and Movement !! paging !! Bacteriology !! Page replacement policy !! Secondary memory and Disk scheduling !! Introduction of Nervous System and neurons !! Plant harmones !! Transport and Mineral Nutrition in Plants !! Neurotransmitters !! Modern Indian History !! Photosynthesis in Plants !! Modern Indian History-II !! Plant respiration !! Environment & Biodiversity !! Environment & Biodiversity - II !! Algae, Bryophytes, Pteridophytes !! Area !! Cricket !! Days of the Year (India and the World) !! Plant Pathology - I !! Indian Transport System !! Plant Pathology - II !! Aptitude !! Biology !! Botany !! C language !! Computer Science !! Core Java !! Gate !! GK !! Mysql !! Operating system !! Physics !! VB-Visual Basic !! Zoology


ADO.NET Projects

ADO.NET Project 1

ADO.NET Examples


The steps involved to fill a dataset?
Previous Home Next

There are following steps to fill a dataset:

    (i). Create a connection object.
    (ii). Create an adapter by passing the string query and the connection object as parameters.
    {iii). Create a new object of dataset.
    (iv). Call the Fill method of the adapter and pass the dataset object.

We can check that some changes have been made to dataset since it was loaded?

There are following way to check that some changes have been made to dataset since it was loaded:

    (i). GetChanges: gives the dataset that has changed since newly loaded or since Accept changes has been executed.
    {ii}. HasChanges: this returns a status that tells if any changes have been made to the dataset since accept changes was executed.

How can we add/remove row’s in “DataTable” object of “DataSet”?

Using NewRow method we can add row's in a data table object of dataset.Remove method of the DataRowCollection is used to remove a ‘DataRow’ object from ‘DataTable’.

RemoveAt method of the DataRowCollection is used to remove a ‘DataRow’ object from ‘DataTable’ per the index specified in the DataTable.


The underlying database can be updated directly by passing SQL INSERT/UPDATE/ DELETE statements, or stored procedure calls, through to the managed provider. It We can also be updated using a DataSet.

The steps are:

  1. Create and fill the DataSet with one or more DataTables
  2. Call DataRow.BeginEdit on a DataRow
  3. Make changes to the row’s data
  4. Call DataRow.EndEdit
  5. Call SqlDataAdapter.Update to update the underlying database
  6. Call DataSet.AcceptChanges (or DataTable.AcceptChanges orDataRow.AcceptChanges)



To update the database directly, we can use the SqlCommand object, which allows us to execute SQL INSERT, UPDATE, and DELETE statements against a database.

Using System;
using System.Data;
using System.Data.SqlClient;
public class empdel {
public static void Main() {
SqlConnection con = new SqlConnection(
string sql = "DELETE FROM emp WHERE emp_name = 'Ashok'";
SqlCommand cmd = new SqlCommand(sql, con);
int i = cmd.ExecuteNonQuery();
Console.WriteLine("{0} record(s) deleted.", i);

To load multiple tables in a DataSet

DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter
             ("Emp", this.Connection);
da.SelectCommand.CommandType =CommandType.
    AddWithValue ("@EId", EId);
           ("Table", ds.xval.TableName);
da.Fill (ds); 

ADO.NET Code showing Dataset storing multiple tables.

DataSet ds = new DataSet();
Previous Home Next