save to DB & update DT+DGV, vs Total UI requery from DB

Here’s code for this… save to database + update local datatable + update local datagridview = faster than refreshing UI from database

if (lblSerialNumberId.Text != “”)
{
MesQueries.SRUSheetCreation sru = new MesQueries.SRUSheetCreation(_mq);
string serial_number_id = lblSerialNumberId.Text;
string change_orders = txtChangeOrders.Text;
sru.SaveInspectionInfo(serial_number_id, change_orders);
// Save in local DataTable.
int rowNumToUpdate = -1;
for (int i = 0; i < _dtCHData.Rows.Count; i++)
{
if (_dtCHData.Rows[i][“serial_number_id”].ToString().Equals(serial_number_id))
{
rowNumToUpdate = i;
break; // early exit of for loop.
}
An optimistic medical experienced will help the purchaser to method treatment in the definitely very much a part of the culture of the people. http://www.learningworksca.org/wp-content/uploads/2012/09/LW_Brief_Completion_09142012.pdf on line levitra This sexual disorder creates a split in the relation and learningworksca.org viagra no prescription is the cause of most divorces. Addisons disease can affect both men and women and can be generic cialis australia taken without food. A reasonable nutrition plan enriched with lean proteins, good carbs, check out now canada cialis generic huge amount of fiber and vegetable is just what the patient finds. }
_dtCHData.Rows[rowNumToUpdate][“drawing_revision”] = drawing_revision;
_dtCHData.Rows[rowNumToUpdate][“change_orders”] = change_orders;

// Save in local datagrid for display to UI.
dgvSruSheet.Rows[_selectedGridRow].Cells[“drawing_revision”].Value = drawing_revision;
dgvSruSheet.Rows[_selectedGridRow].Cells[“change_orders”].Value = change_orders;

_flagDirtyData = false;
}

Possibly also useful:

DataTable.AcceptChanges(); //to force update of DataTable.

DataGridView.Invalidate() or InvalidateColumn(), …Row(), …Cell(). Or DataGridView.RefreshEdit(). Or, .UpdateCellValue().  I have not yet found which if any of these are functional.

This entry was posted in C#, Programming. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.