DataGrid Problems

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a datagrid and have it bound to a datatable which is in an sql server
ce database. I am also using command builder. I seem to be able to edit
some columns and the changes go to the database but not others. I do not get
any errors it just does not update the database.

The other problem is that I can not figure out how to unbind the datagrid
and bind it to another datatable.

Basically during runtime I want to be able to choose which table I want to
edit and have it load into my grid. When I'm done with those edits I want to
be able to choose another table to edit.

Thanks
 
DataSet and DataTable are disconnected in memory objects and they have no
clue data came from SQL CE.

The data presented in the grid is stored in memory and changed in memory as
well.

These changes are never going to be propagated to SQL CE unless you
explicitly do it at some point.

You would not see any errors because nothing's been done to save your data.



Consider adding a button or menu "Save" and execute DataAdapter.Update() to
update the SQL CE database with changed data.

Make sure you have primary key or command builder won't work.



To bind grid to another table, simply set grid's DataSource property to this
new table:



grid1.DataSource = dataSet.Tables[0]; // Now showing table 0.



....



grid1.DataSource = dataSet.Tables[1]; // Now showing table 1.


Best regards,


Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).
 
Back
Top