Question

I have a SQL Server 2012 database with a number of tables. I also have a number of views, all of which use a single base table, there is not a join to be found (but naturally my database does have key constraints between them).

In a project I am working on in VS2012 I have a dataset .xsd file which holds all my table adapters. I can call them just fine. However, when I try to make a new view for one of my view table adapters, the option to "Generate methods to send updates directly to the database (GenerateDBDirectMethods)" is grayed out, which I was not expecting since I am just using a single base table.

Code that defines the view in question

Adding CRUD methods to the view

Était-ce utile?

La solution

Rename the view first, and then reate an empty table with the same structure and the same name as the original view:

SELECT * INTO SurveyPage1 FROM SurveyPage1_view WHERE 1=2

Build your TableAdapter, then delete the table and rename the view back.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top