Link to home
Start Free TrialLog in
Avatar of timberadmin
timberadminFlag for Canada

asked on

C# Visual Studio 2012 Dataset TableAdapter - SQL View - Update/Save

Hi Experts,

First of all I have to say that my skill level in C# is rather basic so please bear with me. I will use AdventureWorks2012 as the example here. I create a SQL view using the statement (Select e.BusinessEntityID, p.Firstname, p.Lastname FROM HumanResources.employee e JOIN person.person p). Now I create a tableadapter in my C# project and use SQL statement to call the view, put it on a gridView and have the user edit say the firstname field. How do I save it back to the sql view? The updateCommand does not generate.
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

The UpdateCommand will only be generated when a primary key can be determined.
Avatar of timberadmin

ASKER

We can't create a primary key on a SQL view though. Perhaps I shouldn't use a view to expose the data to my C# program? What would be the conventional way of achieving something like this?
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