views

MVC Views with the Same Name Issue/Bug

Hey, I have beening using ASP.net MVC for a new website. I have found a minor nagging issue with having views with the same name but are in different folders i.e. Views/Home/Index.aspx and Views/Account/Index.aspx The codebehind files act as if they are partial classes when there is a definition for the same event or function (i.e. Page...

Foreign key referencing composite table

I've got a table structure I'm not really certain of how to create the best way. Basically I have two tables, tblSystemItems and tblClientItems. I have a third table that has a column that references an 'Item'. The problem is, this column needs to reference either a system item or a client item - it does not matter which. System items h...

In MySQL 5.x, is it possible to give permissions based on conditions (not using views)?

In a project I'm starting I would like to give privileges to users based on certain conditions, eg (in a certain table): can READ all rows cannot WRITE to rows with id < x, but can WRITE to row >= x etc... I would like to avoid views as these conditions might change for each user (I understand I would have to create a view for each c...

ASP.NET MVC Beta 1 - Will My Existing User Controls Work In My Views As-Is?

I understand that you can now create MVC-specific user controls, but will my existing standard ASCX user controls work in an MVC view? I understand that MVC pages have a completely different lifecycle but will, for example, a Page_Load method be invoked as normal when the control is sitting in a view? ...

"select * from table" vs "select colA,colB,etc from table" interesting behaviour in SqlServer2005

Apology for a lengthy post but I needed to post some code to illustrate the problem. Inspired by the question What is the reason not to use select * ? posted a few minutes ago, I decided to point out some observations of the select * behaviour that I noticed some time ago. So let's the code speak for itself: IF EXISTS (SELECT * FROM...

Can I atomically rename/replace 2 or more tables and views?

Given a table X and a view Y (that has the same structure as X) is there a way to rename X to Z and Y to X atomically so that no query will ever see nothing named X? Renaming X and creating the view would also be valid. The point would be to, as part of a schema migration plan, replace the old tables with views that simulate the old ver...

How can I create a view in a SQL Server database with C#?

How do I create a view dynamically in SQL Server using C#? ...

How to create ClearCase views automatically?

I'm a configuration manager and I'm working on Windows and UNIX environments. Currently, I have to create the views by myself for the developers and QA engineers. Is there any better approach? Thanks. ...

Linq vs. database views

Here’s an interesting question. Suppose we have related tables in the database, for example, Instrument and Currency. Instrument table has a currency_id field that is mapped to entry in Currency table. In Linq land what’s the better way: a) Create Instrument and Currency entities in the DataContext and then create association or simply ...

Date ranges in views - is this normal?

I recently started working at a company with an enormous "enterprisey" application. At my last job, I designed the database, but here we have a whole Database Architecture department that I'm not part of. One of the stranger things in their database is that they have a bunch of views which, instead of having the user provide the date r...

How to display only taxonomy terms with nodes associated to in Views 2?

Hi, I've created a view with a set filters exposed (to show filtering options in the page). And one of those filters is a select field with all the taxonomy terms of a vocabulary. That's ok, it's showing now. But I want to only show the taxonomy terms that have at least one node associated to it. To avoid empty results if selects an em...

How do Views work in a DBM ?

Hi, Say that I have two tables like those: Employers (id, name, .... , deptId). Depts(id, deptName, ...). But Those data is not going to be modified so often and I want that a query like this SELECT name, deptName FROM Employers, Depts WHERE deptId = Depts.id AND Employers.id="ID" be as faster as it can. To my head comes t...

System Views text in SQL Server 2005

Hello Friends I am looking for viewing the text of the system views and procedures in SQL Server 2005 using the object explorer or using sp_helptext. actually i am coming from the SQL Server 2000 background, where we have the feature of retreiving the code of the view and the stored procedure using SQL Server 2000 Enterprise manager di...

How much logic is allowed in ASP.NET MVC views?

In looking at samples of ASP.NET MVC sites, I'm seeing quite a bit of examples with embedded logic in the views, e.g.: <% if (customerIsAllowed) { %> <p>nnn</p> <p>nnn</p> <p>nnn</p> <p>nnn</p> <p>nnn</p> <% } else {%> <p>nnn</p> <p>nnn</p> <p>nnn</p> <p>nnn</p> <p>nnn</p> <% } %> Although this se...

Passing arguments to views in ASP.NET MVC?

Hi, I've been experimenting with ASP.NET MVC and following this tutorial to create the basic task list application. I've gotten it running fine, everything is working although the video is in VB and I had some trouble getting it "converted" to C# but muddled through thanks to the codesample. Now, to further my knowledge I've decided to...

How to DRY on CRUD parts of my Rails app?

I am writing an app which - similarly to many apps out there - is 90% regular CRUD things and 10% "juice", where we need nasty business logic and more flexibility and customization. Regarding this 90%, I was trying to stick to the DRY principle as much as I can. As long as controllers go, I have found resource_controller to really work,...

Implementing Forms in ASP.net MVC

I have a simple form on a view page, implemented as a user control, that looks something like this: <%=Html.BeginForm("List", "Building", FormMethod.Post) %> //several fields go here <%Html.EndForm(); %> There are two problems I would like resolved, the first is that I would like the controller method that receives this to take a ty...

Cycling through array of objects within view in Rails: unexpected behaviour

Hi. I've got a simple calendar displaying some events, that's not quite giving me the expected results. Here's the code: <!-- Begin Calendar --> <%= calendar(:year => @year, :month => @month, :first_day_of_week => 1) do |d| output = [] output << render_calendar_cell(d.mday) if d.wday == 1 @garden.plants.collect do |p|...

SQL Server: Is it faster to retrieve or filter data from views using stored procedure than getting or filtering data from tables using stored procedure?

Hi, are there performance issues when retrieving and filtering data from views than from tables by using a stored procedure? Simplification: Is it faster to retrieve or filter data from views using stored procedure than getting or filtering data from tables using stored procedure? ...

displaying # views on a page without hitting database all the time

More and more sites are displaying the number of views (and clicks like on dzone.com) certain pages receive. What is the best practice for keeping track of view #'s without hitting the database every load? I have a bunch of potential ideas on how to do this in my head but none of them seem viable. Thanks, first time user. ...