So, I have a form, containing several textboxes.
When a user click elsewhere on the form, the texboxes are bound/populated with values from a single record.
(Parent-child)
However, where I am struggling, is that I need any manual edit of those textbox values to be written back to the originating table record.
Despite lots of googing - i'm still trying to get my head around how to get my textbox edits to write back.
Hope someone can point me in the right direction ?
Thanks
public void bindCurrent(string attachmentIdx) {
// sql used to select data
string sql = "SELECT * FROM Ticket_Attachment";
// get an open connection to DB
sqlexp ce = new sqlexp();
SqlCeConnection cnn = ce.openCnn();
// data apapter > fill
SqlCeDataAdapter da = new SqlCeDataAdapter(sql, cnn);
SqlCeCommandBuilder cb = new SqlCeCommandBuilder(da);
DataTable dt = new DataTable();
da.Fill(dt);
// bs is BindingSource
bs.DataSource = dt;
bs.Filter = "idx = '" + attachmentIdx + "'"; // idx is primary unique not null
if (txt_at_idx.DataBindings.Count == 0){
txt_at_idx.DataBindings.Add("Text", bs, "idx");
}
}