I cant select records based on a where clause and row limit.
I want the first 5 rows with where clause from1='x'. What happens is that this checks rows 1 and 5 and from that selects any that have from1='x'. so i could have 0 to 5 only .
command.CommandText = " SELECT * FROM ( SELECT email.* " & _
" , ROW_NUMBER() OVER (ORDER BY id) AS [RowNumber]" & _
" FROM email) sq WHERE RowNumber BETWEEN " & pageNo & " AND " & rowsPerPage & " and to1='x'"