By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,411 Members | 1,483 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,411 IT Pros & Developers. It's quick & easy.

Update records in a datagrid and save it in database

P: n/a
Dear,

I have on a form a datagrid (datagrid1) which is filled by a dataset created
in the class Afwezigheid. A button "Alles" show the whole table in the
datagrid and when someone wants to change the data, I have to use a
sqldataadapter which has an Update method. But how can I link this all ?

Thank you very much,

Hugo Lefevre

Filling up the datagrid :
----------------------

Afwezigheid frmAfw = new Afwezigheid( out ds);
dataGrid1.SetDataBinding(ds, "Afwezigheid");

Creation of the dataset in the class Afwezigheid :
------------------------------------------------

public Afwezigheid(out DataSet ds)
{
SqlSelectie = "select * from Afwezigheid; ";
Database db = new Database();
SqlConnection conn = db.Opent();
SqlCommand cmd = new SqlCommand(SqlSelectie, conn);
SqlDataAdapter da = new SqlDataAdapter(SqlSelectie, conn);
ds = new DataSet();
da.Fill(ds, "Afwezigheid");
conn.Close();
}

What have I to do to write this code in the class Afwezigheid :
---------------------------------------------------------------

private void btnUpdate_Click(object sender, System.EventArgs e)
{
?????????????????????????????????????
}
public void DbUpdateAfw(DataSet ds)
{
da.Update(ds, "Afwezigheid");
}
Nov 15 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.