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.
Who is Participating?
Bob LearnedConnect With a Mentor Commented:
The conventional way is to have two adapters, each connected to different sources, and then create a relation in the DataSet that gets filled from both adapters.  

I never did really like that pattern.  I would look into the Entity Framework, since it is miles ahead of the traditional table adapter pattern.
Bob LearnedCommented:
The UpdateCommand will only be generated when a primary key can be determined.
timberadminAuthor Commented:
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?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.