dimanche 28 juin 2015

Why TableAdapter doesn't recognize @parameter

I am using table adapter Query configuration wizard in Visual studio 2013 for getting data from my database. For some queries like this:

SELECT *
FROM ItemsTable
ORDER BY date_of_creation desc, time_of_creation desc
OFFSET (@PageNumber - 1) * @RowsPerPage ROWS
FETCH NEXT @RowsPerPage ROWS ONLY

it doesn't recognize the @pageNumber as a paremeter and it cannot generate function that has these arguments while it works fine for queries like:

Select Top (@count) * from items_table

Why does in first query tableadapter fail to generate function with mentioned arguments whereas it can generate function fine for second one for example: tableadapter.getDataByCount(?int count)

Am I forced to use stored procedure, if yes since I don't know anything about it how?

Aucun commentaire:

Enregistrer un commentaire