It is used in disconnected architecture. It
represent records in the form of Database table (Row and Column) format.
It stores record of one or more tables.
Example:
Methods of DataSet:
Example:
- SqlDataAdapter da;
- DataSet ds;
- string strconn = "Data Source=YourServerName;Initial Catalog=EMP;Integrated Security=True";
- private void Form1_Load(object sender, EventArgs e)
- {
- da = new SqlDataAdapter("select * from userdet", strconn);
- ds = new System.Data.DataSet();
- da.Fill(ds);
- dataGridView1.DataSource = ds.Tables[0];
- }
- AcceptChanges(): This method saves changes which are made with records in a DataSet.
- Clear(): This method clears (removes) all rows from DataSet.
- Clone(): The clone method copy the structure of DataSet. Means it copy only schema not full records of DataSet.
- Copy(): It copies the whole records with structure of DataSet.
- RejectChanges(): This method discard changes which is made with DataSet and set the DataSet to previous stage (which was at first).
- HasChanges(): This method return boolean value to show whether record of DataSet has changed or not. It returns true if any changes has made and false if no other changes made.
- GetChanges(): This method keep copy of those record, which is changed or modified.
0 comments:
Post a Comment