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
Can't programmatically insert new data to a grid.
posted

I have a WinGrid pulling from a datasource... specifically, it's pulling data from an MS-SQL database.  The datasource has a single table.  What I want to do is pull the data in, then allow the user to do some sort of automated processing.  In this case, the program will scan through and consolidate indivdual values into ranges, the purpose being to decrease the number of rows by collapsing individual values into ranges of values.  So it's necessary to delete the rows I don't want and to insert the new rows with the comprehensive ranges.

I wrote the code to process the data, no problem.  It builds a list of what needs to be deleted and what needs to be added.  Then it deletes the rows in question.  Last but not least, it inserts the new rows.  That's when the error occurs: "Row insertion not supported by this data source"

Let me be clear.  At this point in the process I have complete lists of what needs to be deleted and inserted.  The data deletes properly.  Testing up to that point shows that it works fine. The grid/datasource displays the rows in the table, then shows the table after the specified rows have been deleted, all correctly.  But when I try to programatically insert the new data, the error occurs.  I have everywhere I can find set to allow adds.  I made sure none of the columns are read-only.

This is the code that performs the actual add to the row.

UltraGridRow row = grdLCDDiags.DisplayLayout.Bands[0].AddNew();

row.Cells["BeginCode"].Value = ListOfActions[ndx].Diags.DiagBegin;

 

row.Cells["EndCode"].Value = ListOfActions[ndx].Diags.DiagEnd;

row.Update();

 

I am working with C# in .NET 2008, and I am using version 8.2.20082.2011 of the WinGrid (runtime version v2.0.50727).  Thanks in advance for any advice.