Drunkard's Walk Forums

Full Version: I have a C# question.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
And I hope someone reading can answer.  (And yes, I've Googled the problem, which turns out to be very common and not clearly addressed, at least in the pages I've read; and the solutions therefrom that I've tried do absolutely nothing, or worse, put the app into an endless loop terminating with a stack overflow.)

I'm working for the first time with a DataGridView, in what is fundamentally a simple database application:  The grid holds a filtered set of rows, and the user theoretically can add rows to the filtered set.
Except I can't commit changes to the underlying table.

More detail:  

The grid's datasource is a dataview of a table which I'll call TheTable for simplicity's sake.  The table is a member (along with two other tables) of a very small dataset generated from a T-SQL database I'm accessing across a network.  Basically:  

Quote:dvTable = new DataView(MyDataSet.TheTable);

Grid.DataSource = dvTable;
I apply filters to the dataview to change the contents of the grid.

Now, I thought the dataview was supposed to transparently handle changes to the grid contents that needed to be committed to the underlying table, but that's not happening.  I've tried attaching a number of handlers on different events and trying to manually commit data, with no luck -- or perhaps too much, because I've run into situations where doing an AcceptChanges() ends up triggering the same event that the AcceptChanges() was called in, endlessly.

Has anyone any experience getting something like this to work in C#, or have sufficient .NET experience to offer advice?

Thanks in advance.

Edit:  For reasons I can't get into here, setting up an entity model is not an option currently available to me.  Again, thanks.
-- Bob
---------
Then the horns kicked in...
...and my shoes began to squeak.
Sorry, I'm only really into dynamic languages these days, and I'm not really in the MS ecosystem.  Have you tried StackOverflow?  If you do that, explain why other questions/answers on that site haven't solved your problem.
-- ∇×V
Oh yeah, Stack Overflow is one of my go-to resources for questions like these. And since posting this I got some idea of the cause of the problem, though mainly as a gestalt effect of a lot of articles from a lot of places. As a result I've changed the approach I'm using. I'm not quite done with the implementation yet, but I'm confident it will work -- of course, though, I changed out one (largish, game-breaking) problem for another (smaller, far less critical) problem in the process. The new problem is quite surmountable, it's just annoying that it exists.
-- Bob
---------
Then the horns kicked in...
...and my shoes began to squeak.