View Single Post
  #3 (permalink)  
Old February 27th, 2012, 10:03 PM
Imar's Avatar
Imar Imar is offline
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

I sorta got the idea after your second group.

But anyway, yes you'd need different queries for this scenario. Or at least, a different WHERE clause. Depending on how you wanrt to implement it, you could simply restrict access to pages that the user doesn't belong to. Alternatively, you could dynamically build your SQL statements and include the roles the user belongs to.

Either way, you'll find it difficult to use the SqlDataSource control for this as it's a bit difficult to dynamically change the SQL statement (it can certainly be done but requires more work than I typically care to put into it).

I would recommend using EF which makes this simpler. Or you could use ADO.NET directly and use objects such as the SqlConnection and SqlDataReader to get data out of the database.

Hope this helps,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote