Wrox Programmer Forums
|
Visual Web Developer 2008 Discuss creating ASP.NET 3.5 sites with Microsoft's Visual Web Developer 2008. If your question is more specific to a piece of code than the Visual tool, see the ASP.NET 3.5 forums instead. If your question is specific to the "Express Edition" be sure to state that in your post.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Web Developer 2008 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 20th, 2008, 05:49 PM
Friend of Wrox
 
Join Date: Apr 2006
Posts: 160
Thanks: 0
Thanked 0 Times in 0 Posts
Default sql advanced option not available

Hi,

i defined a sqldatasource in VWD. The table involved in the select is vw_aspnet_Roles. No problem so far, but when i try to take the advanced option (insert, delete ..), the option is not available (can't check it), even when i take all fields (with primary keys).

Why is that and can it be solved in VWD?

Thanks

H.

 
Old February 20th, 2008, 08:04 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

This isn't a VWD question it is a SQL question. I am going to assume that you do not understand how SQL works as that is the logical reason for your query.

Simply put a view isn't a table it is a view of some arbitary data; in your specific case the view is composed of this code:

SELECT ApplicationId, RoleId, RoleName, LoweredRoleName, Description
FROM dbo.aspnet_Roles

This is a very basic view and, in reality, there is no difference between doing
SELECT * from vw_aspnet_Roles and
SELECT * from aspnet_roles

It yeilds the same data. The reason you are having this problem, as i said, is because a View is a representation of data from 1 or many tables, it isn't actually a table in and of itself thus it can't be inserted, updated, or deleted from. To actually alter the view you need to make changes to the table the view references, in this case aspnet_Roles.

To correct this, alter your select statement to be something like:

SELECT ApplicationId, RoleId, RoleName, LoweredRoleName, Description
FROM dbo.aspnet_Roles

the datasource should then allow you to provide insert, update, and delete commands.

hth.


================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor / Author :.
Wrox Books 24 x 7
================================================== =========
 
Old February 21st, 2008, 01:56 PM
Friend of Wrox
 
Join Date: Apr 2006
Posts: 160
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I didn't know that 'vw' meant view.
Thanks

 
Old February 21st, 2008, 02:10 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

'vw' doesn't necessarily mean view but it is a logical prefix. In any event you will notice that this particular data element exsits underneath the 'Views' folder as opposed to the Tables folder in your Database Explorer in VWD.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor / Author :.
Wrox Books 24 x 7
================================================== =========
 
Old February 21st, 2008, 05:20 PM
Friend of Wrox
 
Join Date: Apr 2006
Posts: 160
Thanks: 0
Thanked 0 Times in 0 Posts
Default

In fact, i have still the same question:
why does VWD show in the dropdownlist a view of aspnet_roles instead of simply the table itself, like for all my own created tables?
Because they are 'special' tables created by aspnet during creating users?
Thanks

 
Old February 21st, 2008, 05:37 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

VWD might be blocking them, sure. You can override the wizard and do something like this:

<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:AppString1%>"
SelectCommand="SELECT RoleId, RoleName FROM
aspnet_Roles"
UpdateCommand="UPDATE aspnet_Roles SET [RoleName]=@RoleName,
WHERE RoleId = @RoleID">
</asp:SqlDataSource>

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor / Author :.
Wrox Books 24 x 7
================================================== =========





Similar Threads
Thread Thread Starter Forum Replies Last Post
Create Check Boxes/Option buttons/Option Group hewstone999 Access VBA 1 March 14th, 2008 07:25 AM
Autoclose option in SQL server 2005 express ? jeyaprabhuj SQL Server 2005 1 March 22nd, 2007 02:38 PM
Looking for advanced CSS dimo414 BOOK: Professional CSS: Cascading Style Sheets for Web Design 0 May 29th, 2006 10:57 PM
Mail Option in SQL SERVER ksrmramu SQL Server 2000 1 August 2nd, 2005 12:08 PM
Please Help with advanced sql query mstuart60 SQL Language 1 June 22nd, 2003 03:19 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.