Link to home
Start Free TrialLog in
Avatar of grouchyfd
grouchyfdFlag for United States of America

asked on

How do I update and delete from a datagridview that is bound to a view table from a database?

I have VS 2005. I have created a  view in my database combining data from 2 different tables. I can update & delete from Ent. Mgr. When I create a datagrid view or a "details"  object from the datasource in my ADO.Net app., I get the data from the combined tables entered into the form, but the "save" button is not enabled. I enable the the button but I still cannot update the data entered or deleted in the form. How do I manipulate the data in my dataview thru my form?

Thanks
Avatar of grouchyfd
grouchyfd
Flag of United States of America image

ASKER

Or another way of putting it, I want to add an unbound column to a datagrid. That datagrid is already bound to a data table. Column1 in the datagridview is EmployeeID and shows the ID number. I would like Column1 to show the Name associated with the EmployeeID from the related Employee table, instead of the ID number.
Avatar of Bob Learned
1) If you are using Inner Joins, or any other complex queries like that, you will not be able to update.  

2) Are you using Table adapters?

Bob
I tried to create a view using joins and found that the table adapter wouldn't allow me to update. When I tried to code it, the intelisence would not bring up the update command. When I go to Enterprise manager and create a view there, I can update it. I guess I'll try to see if I can do it through a SQL command.
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I won't be able to get to my machine until tomorrow. But I'll have to see if I included or not the PK field. I didn't really think about not having enough of the fields, but it does sound logical.