ASP.NET with C# and SQL SERVER , some vb.net . asp.net examples, asp.net codes, asp.net programs, c# code, sql server queries, important codes.
Saturday, 20 October 2012
update data from dataset into database table from asp.net c#
private void LoadData()
{
if(ds != null)
ds.Clear();
adap = new SqlDataAdapter("select id,title, description from testtable", con);
ds = new DataSet();
adap.Fill(ds);
dataGrid1.DataSource = ds.Tables[0];
}
//This click will update one of the field in the database using adapter update() method on
dataset.
private void btnUpdate_Click(object sender, System.EventArgs e)
{
SqlCommandBuilder com = new SqlCommandBuilder(adap);
foreach(DataRow dr in ds.Tables[0].Rows)
dr["title"] = txtTitle.Text;
adap.Update(ds);
}
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment