Click here to Skip to main content
15,898,222 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,
I have a vb net 2015 aoolication and want to access an sql server 2014 database, I want to use paging but get an error from sqldataadapter
1) invalid usage of the option NEXT in the FETCH statement
here is the code
SQL
SELECT        *
FROM    Table_1
ORDER BY id DESC 
OFFSET 0 ROWS 
FETCH NEXT 20 ROWS ONLY


What I have tried:

the code above but gives errors
Posted
Updated 16-Jun-17 23:20pm
v2

1 solution

Your statement works fine for me, on SQL Server 2012, so I would expect it to work on SQL 2014 as well (it wasn't supported by SQL Server 2008, but was from 2012 onwards.

Check you are running on the server instance you think you are:
SELECT @@VERSION
will return something like this:
Microsoft SQL Server 2012 (SP2-GDR) (KB3194719) - 11.0.5388.0 (X64) 
	Sep 23 2016 16:56:29 
	Copyright (c) Microsoft Corporation
	Express Edition (64-bit) on Windows NT 6.3 <X64> (Build 15063: )
(which is what mine returns). I'm betting you are running 2008...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900