Add extra database field to be_Pages table

Topics: ASP.NET 2.0, Business Logic Layer
Sep 25, 2012 at 7:40 AM

I have added an extra field to the be_Pages table that I call VirtualPath. This is so that I can have virtual paths to my pages. In the code I add "VirtualPath" as an extra variable to the Pages class.

In DbBlogProvider there is a routine called "Page SelectPage(Guid id)". Here I include "VirtualPath" to the CommandText (i.e. add it to variable sqlQuery) which means that there will be 14 elements to pick from the database. Furthermore, I duplicate the routine to grep the actual value:

if (!rdr.isDbNull(14)) {

page.VirtualPath = rdr.GetString(14);

}

The problem is that the it never enters the if-statement, the line "page.VirtualPath = rdr.GetString(14);" is never executed. When I step the code and I arrive at the !rdr.isDbNull(14)-row and do step-in I see that the DbConnectionHelper disposes the connection.

My question is: Is there somewhere else I have to do a change in order to add an extra parameter like this? Or, does anyone have an idea of what I do wrong. And yes, I have entered values to the VirtualPath-field in the database so it should not be null.