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.
timberadminAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bob LearnedCommented:
The UpdateCommand will only be generated when a primary key can be determined.
0
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?
0
Bob LearnedCommented:
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.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.