Thursday, March 13, 2014

How to do Select Top in Oracle

In SQL Server I often do a SELECT TOP 10 FROM [TableName].

To get the bottom ten I found that I could ORDER BY DESC.

In Oracle things are a bit different. In Oracle they have a ROWNUM system field. To get the first ten records you just have to get the ROWNUMs that are 10 and below like the following:

SELECT * FROM [TableName] WHERE ROWNUM >= 11

Control 'gv' of type 'GridView' must be placed inside a form tag with runat=server.



I have gotten this error several times:

Control 'gv' of type 'GridView' must be placed inside a form tag with runat=server.

Each time I forget the solution and after I fix it I eventually forget why I was getting it.  This time is not different.  I can't remember why it started happening, but the solution is to create a method like this.

public override void VerifyRenderingInServerForm(Control control)

{
 
/* Verifies that the control is rendered */
}

Sometimes & nbsp; Doesn't Work and I Have to Use & #160; Instead

I found recently that sometimes when I use an HTML & nbsp; it literally prints & nbsp; instead of a nonbreaking space.

Blogger is having trouble taking what I want to say, so I have to put a space between the ampersand and the nbsp; characters to get it to print correctly.

One instance that gave me trouble with the nbsp was between a td tag, even though I can include other HTML markup in between the opening and closing tag.

After some head scratching and reading I tried using a & #160; and that worked.

I guess HTML has two different ways of expressing non breaking spaces.