private void btnSearch_Click(object sender, EventArgs e)
{
groupBox3.BringToFront();
string sqlcondition="ORDER BY iEmpID";
fnEmpView(sqlcondition);
}
Incorrect syntax near the keyword 'ORDER'....pls correct as soon as possible

Jignesh TrivediRank #16 · 50.3K reputationPosted Dec 12, 2013, 1:39 AM EST
can you please share fnEmpView function code so that we can verify...?
Maneesh A N179 reputationPosted Dec 12, 2013, 1:41 AM EST
Jignesh TrivediRank #16 · 50.3K reputationPosted Dec 12, 2013, 1:50 AM EST
hi,
Store procedure is same as http://www.c-sharpcorner.com/Forums/Thread/240289/error-sql-2005in-dynamic-query.aspx
if yes than try with store procedure..
alter procedure prcEmpView
(
@Wherecondition nvarchar(4000)
)
as
begin
declare @sqlquery nvarchar(4000)
set @sqlquery=
'select
vEmpName,
vAddress,
vPhone,
vEmail
from tblEmployee '+@Wherecondition
exec(@sqlquery)
end
hope this will help you.
Maneesh A N179 reputationPosted Dec 12, 2013, 2:02 AM EST
Jignesh TrivediRank #16 · 50.3K reputationPosted Dec 12, 2013, 2:44 AM EST
I am not getting you. can you please provide more information?