Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
125
XamDataGrid saving edited cell values to database
posted

I have a editable XamDataGrid bound to a Dataset as shown:

<Custom:XamDataGrid x:Name="usersXamDataGrid" DataSource="{Binding}" Margin="150,400,150,-0.2"  />

It is being filled using SqlDataAdapter:

using (SqlConnection conn = new SqlConnection(connectionString))
{
SqlCommand usersSelectCommand = new SqlCommand("SELECT name, age FROM Users", conn);

SqlDataAdapter usersAdapter = new SqlDataAdapter(usersSelectCommand);

usersAdapter.Fill(usersDataSet, "Users");
}

Then binding the dataset to the grid's datasource:

this.usersXamDataGrid.DataSource = usersDataSet.Tables["Users"].DefaultView;

What's a good way to save changes to edited cells in the XamDataGrid?