Updating data to datagridview

W

weird0

How can i update the data in my database directly through
datagridview....? Can anyone tell me the appropriate links and what is
the exact event in datagridview that handles it and some explanation
abut how to handle it.

what does ds.Tables[0]...ds.Tables[string name] return by the way?
What does it mean?

DatagridView.DataSource=ds.Tables[0]; // one of the statement in my
code Why?

What is a DAtaSet and DataAdapter? Some links plz.

I have successfully displayed data in the datagridview.
 
N

Nicholas Paldino [.NET/C# MVP]

See inline:

weird0 said:
How can i update the data in my database directly through
datagridview....? Can anyone tell me the appropriate links and what is
the exact event in datagridview that handles it and some explanation
abut how to handle it.

You can't do it. Assuming you are bound to a DataSet/DataTable, at the
point you want to update the database (that's up to you to decide when), you
have to pass the changed DataSet/DataTable through a data adapter,
performing the update yourself.
what does ds.Tables[0]...ds.Tables[string name] return by the way?
What does it mean?

Assuming ds is a DataSet, ds.Tables[0] will return the first DataTable
instance that the DataSet stores. The call to the string indexer on the
Tables will return the DataTable with that name.
DatagridView.DataSource=ds.Tables[0]; // one of the statement in my
code Why?

I don't know what you mean by this.
What is a DAtaSet and DataAdapter? Some links plz.

A DataSet is a set of DataTables, along with any relations
(DataRelation) between those tables. It is an in-memory representation of
data.

A DataAdapter will take a DataSet/DataTable and based on the changes
made to it, iterate through the changes and execute a command against the
underlying data source for each change in the DataTable.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top