I have a datagrid that is populated from a view in SQL server. When I set the datasource on load it works fine. However, when I update and then try to reload the grid I get an error saying column dos not belong to table. anyone have any ideas?
It would seem that when you are reloading your data you are using a different dataset to when you first load it, with one of the columns that the datagrid is expecting missing.
And you call that same bit of code when you load and re-load? hrm .. will have to think about that then!
Have you tried stepping through all of the code in debug mode and checking the status of everything, ie the dscalldetails dataset gets repopulated properly ...
Yes, I have stepped through the code....I really appreciate you trying to help, cause I am stumped! What I am doing exactly is updating a table that my view is pulling from. After I update the table, I am trying to reload the grid using the code above. (Same code I use to load it). I have tried everything. Anything you can come up is appreciated.
Here is the other weird thing...and maybe you can determine the problem from this. It will work the first time the code is called to reload the grid. It throws the error on the second time the code is called. And if I change the table name...ie...
cmCallLog.Fill(dsCallDetails, "ViewCallDetails"
Ok i have searched hi and low but I haven't found anything.
Just do me one favour. Put a stop at this line
cmCallLog.Fill(dsCallDetails, "ViewCallDetails" and step over it at it the second time you load the grid (after the update) but don't execute the line where you bind the grid.
Have a look and tell me what the value of
dsCallDetails.tables("ViewcallDetails".rows.count is
Sorry but I have run out of ideas! Maybe it's something to do with creating a table in a dataset that already exists ...
I so appreciate your help....and so you know ....I did do what you requested to no avail...I had a valid row count ...and when updating tables that my view pulls from I had a valid number of updated rows...that is why I was so stumped...but I did solve the error...and here is how...I still can't believe this solved it ...but for future reference and for anyone else who may encounter this...I had to first call the schematype to load the table metadata.....
cmCallLog.FillSchema(ds,schemaType.Source, "ViewCallDetail"
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.