This should be a really simple example. I added a user table with only edit fields and no combo boxes, check boxes, etc. This form can only edit values and can not add or delete rows. There is only one data source on the form.
I am using LoadFromDataSource to populate a matrix and that works without any problems. If I change a value on one of the rows the form changes to edit mode. If I update nothing happens and the form stays in update mode. I use FlushToDataSource and for large result sets I get an hour glass. Using SQL profiler I see each row being queried one at a time but nothing is ever actually updated.
If I requery after FlushToDataSource by using oMatrix.Clear() and oMatrix.LoadFromDataSource() the changes are lost. This occurs even if I actually requery the data source before using LoadFromDataSource(). If I try to force the form to "ok mode" then edit mode is cancelled and the changes are lost.
So, what am I missing? This should be really simple. I don't want to iterate through the matrix to get and update each line to the database.
Reading looks like this and works fine:
oForm.Freeze(true); oMatrix.Clear(); oMatrix.AutoResizeColumns(); SAPbouiCOM.Conditions oConditions = new SAPbouiCOM.ConditionsClass(); SAPbouiCOM.Condition oCondition; oCondition = oConditions.Add(); oCondition.BracketOpenNum = 1; oCondition.Alias = "U_BatchId"; oCondition.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL; oCondition.CondVal = intBatch.ToString(); oCondition.BracketCloseNum = 1; SAPbouiCOM.DBDataSource ds = _SBO_Application.Forms.ActiveForm.DataSources.DBDataSources.Item("@XXRIQBDET"); ds.Query(oConditions); oMatrix.Clear(); oMatrix.LoadFromDataSource(); oForm.Freeze(false);
Update looks like this but does nothing:
oMatrix.FlushToDataSource(); //oMatrix.Clear(); (this causes the changes to be lost) //oMatrix.LoadFromDataSource();
Am I supposed to be required to iterate through the dataset after the flush and define a UserTable for my table and manually update each changed record one at a time? I thought FlushToDataSource() was supposed to do that.