c# - MySQL update once WPF DataGrid cell has been edited -
I have a datagroup which is generated from a MySQL query. I want to be able to modify the datagrid and edit the database directly. Basically I need that the user has finished editing the cell after generating such a string:
Pseudocode:
"UPDATE current_table SET current_column_name = New_cell_value WHERE id = The number of edited row ""
is in the first cell hidden, what would be the easiest way to get it?
Have tried to see and events but so far I have no "celled edited" Events have not been found and neither can I get the new value or ID in the first cell of that line.
EDIT: OK, I have made some progress, I now get the ID and column name I am able to do this, but the problem is that I am unable to get the new cell value. I think the problem is that this code sets fire on the Edit Editing Event, so the change has not yet been done. I can how to fix it?
Detarav view Detaro = (Detarvdrishy) Gemdetagrid. Selected items; Int index = gameDatagrid.CurrentCell.Column.DisplayIndex; String columnName = gameDatagrid.CurrentCell.Column.Header.ToString (); String cellvalue = dataraave.roeitemarere [index] ostring (); String id = detarro.roitimate array [0]. Ostring (); MessageBox.Show (id + ":" + columnName + ":" + cellValue); Thanks for a helpful comment I was able to solve it.
Private Zero GameDataGride Tag Element (Object Sender, Data Gridel Edit EntringEvent E) {Text Box T = E. Element as text box; DataRowView Detarro = (Detorvision) GameDataGrid. Selected Items; Int index = gameDatagrid.CurrentCell.Column.DisplayIndex; String columnName = gameDatagrid.CurrentCell.Column.Header.ToString (); String NewView = T. Text; Ent ID = (Int) Detouro.roeitere [0]; String query = "UPDATE table_name SET" + columnName + "= \" "+ newValue +" \ "WHERE id =" + id; }
Comments
Post a Comment