hi,
in my front end application i take one dropdown list and datagrid. that dropdownlist purpose is sorting data. i take Ename, Esal, Dept three items to the dropdownlist.
if user select any one item from dropdownlist, that time data diplayed sorting order of selected item.
i am write stored procedure like:
create procedure sp_Sortdata
(
@Orderbyclause varchar(50)
)
as
begin
selecet * from emp order by @Orderbyclause
end
and i am facing this error
The SELECT item identified by the ORDER BY number 1 contains a variable as part of the expression identifying a column position. Variables are only allowed when ordering by an expression referencing a column name.
please correct my query and please give a solution
Thanks