Sql – Visual Studio Website: Advanced SQL Generation options greyed out/disabled

asp.netsqlvisual studio 2010web-applications

I'm very new to Visual Studio, Asp.net and website design. But I have searched the forums thoroughly and have not seen my exact question referenced.

I am attempting to build a webpage in Visual Studio that ties into a SQL Server backend. When trying to configure my data source, I want to be able to generate insert, update and delete statements. In the beginning, when I tried to do this with a table, the advanced options were grayed out. But then I searched the web and found out that I need a primary key on my table before these options would be available. Initial problem solved.

However, now I want to specify a VIEW for my data source, not a table. The VIEW combines data from two or three tables that I want my webspage to submit data to. So now, when I select my VIEW and then click "Advanced", the Advanced SQL Generation options are greyed out. If I choose one of my tables, the advanced options are available. But is it possible to have them available if I select a VIEW instead? If not, any suggested workarounds for building a web form that needs to be tied to 3 different tables?

Thanks very much for your time and patience with this newbie.

Best Answer

You are able to insert, update and delete using the view but there are a number of conditions that will stop you doing this. Basically your view must be based on the raw data from each of the tables. As soon as you start to derive values or use aggregate functions you'll only be able to view the data. This might be what's greying out the advanced properties. Have a look at http://msdn.microsoft.com/en-us/library/ms180800(v=sql.90).aspx for the full list of restrictions.