GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Microsoft  >  Ado.NET
Go To First  |  Previous Question  |  Next Question 
 Ado.NET  |  Question 20 of 31    Print  
How do you update a Dataset in ADO.Net and
How do you update database through Dataset

  
Total Answers and Comments: 9 Last Update: May 03, 2008     Asked by: sbehera02 
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: hasham13
 
a. Update a dataset;
Dataset ds = new dataset();
SqlDataAdapter adp = new SqlDataAdapter(Query,connection);
Adp.fill(ds);
Again you can add/update Dataset as below
SqlDataAdapter adp1 = new SqlDataAdapter(Query1,connection);
 Adp1.fill(ds);

b. Update database through dataset.
SqlCommandBuilder mySqlCommandBuilder = new SqlCommandBuilder(mySqlDataAdapter);
Foreach(datarow dr in ds.table[0].rows)
{
Dr[“column Name”] = “value”;
mySqlDataAdapter.Update(ds);
}

Above answer was rated as good by the following members:
prabhukumar.r, drsudhak, thitnaing
December 21, 2006 04:25:33   #1  
syed abdul kather        

RE: How do you update a Dataset in ADO.Net and How...
i am not sure that this is right we can update our dataset by updating data adapter ex :- string str Provider Microsoft.Jet.OLEDB.4.0;Data Source My Documents/syed.mdb ; OleDbConnection con new OleDbConnection(str); OleDbDataAdapter ada new OleDbDataAdapter( select * from student con); DataSet ds new DataSet(); ada.Update(ds employee); DataGrid1.DataSource ds.Tables[0].DefaultView; DataGrid1.DataBind();
 
Is this answer useful? Yes | No
December 21, 2006 22:26:10   #2  
sbehera02 Member Since: July 2006   Contribution: 18    

RE: How do you update a Dataset in ADO.Net and How...

Hi syed abdul kather

What i am saying First you Fill Dataset or Update Dataset Then how you updated Databse?


 
Is this answer useful? Yes | No
January 03, 2007 14:37:58   #3  
jai_mnti Member Since: December 2006   Contribution: 3    

RE: How do you update a Dataset in ADO.Net and How...
You update the dataset using the fill() and update the database using the update() method of the dataset
 
Is this answer useful? Yes | No
February 08, 2007 07:24:54   #4  
dharmesh kubavat        

RE: How do you update a Dataset in ADO.Net and How...
Using Update method of Data Adapter : DA.Update(DS)
 
Is this answer useful? Yes | No
March 29, 2007 12:16:33   #5  
sahu Member Since: December 2005   Contribution: 323    

RE: How do you update a Dataset in ADO.Net and How...
Hi


Ans:


Step 1:

//Fill the DataSet by using SqlDataAdapter (sDa)
sDa.Fill(ds)// ds is DataSet Object

Step two:

// Change DataSet and update by using sDa.update(datasetopbject) Method

sDa.update(ds);//it will update DataBase







 
Is this answer useful? Yes | No
April 18, 2008 03:17:58   #6  
ynvpavan Member Since: September 2007   Contribution: 16    

RE: How do you update a Dataset in ADO.Net and How do you update database through Dataset
It's sure u can easily update the data by using the code as following:


DataSet objDataset1 new DataSet();

objAdapter1.Fill(objDataset1);

objConn.Close();


 
Is this answer useful? Yes | No
April 18, 2008 03:21:28   #7  
ynvpavan Member Since: September 2007   Contribution: 16    

RE: How do you update a Dataset in ADO.Net and How do you update database through Dataset
And updating database through dataset will be by following code:


foreach (DataRow row in objDataset1.Tables[0].Rows)

{

string Loannumber row[0].ToString();int count bllObj.Savenumber(number DateTime.Now);

total + count;

}


where bll is the object of business layer


 
Is this answer useful? Yes | No
May 01, 2008 16:12:57   #8  
hasham13 Member Since: February 2008   Contribution: 1    

RE: How do you update a Dataset in ADO.Net and How do you update database through Dataset
a. Update a dataset;
Dataset ds new dataset();
SqlDataAdapter adp new SqlDataAdapter(Query connection);
Adp.fill(ds);
Again you can add/update Dataset as below
SqlDataAdapter adp1 new SqlDataAdapter(Query1 connection);
Adp1.fill(ds);

b. Update database through dataset.
SqlCommandBuilder mySqlCommandBuilder new SqlCommandBuilder(mySqlDataAdapter);
Foreach(datarow dr in ds.table[0].rows)
{
Dr[“column Name”] “value”;
mySqlDataAdapter.Update(ds);
}

 
Is this answer useful? Yes | NoAnswer is useful 2   Answer is not useful 0Overall Rating: +2    
May 03, 2008 09:40:33   #9  
PratapCh Member Since: May 2008   Contribution: 1    

RE: How do you update a Dataset in ADO.Net and How do you update database through Dataset
We will update the dataset by calling Update Method.
We will update the database by calling AcceptChanges Method.

 
Is this answer useful? Yes | NoAnswer is useful 2   Answer is not useful 0Overall Rating: +2    


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape