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 TrivediPosted Dec 12, 2013, 7:44 AM
I am not getting you. can you please provide more information?
Maneesh A NPosted Dec 12, 2013, 7:02 AM
Jignesh TrivediPosted Dec 12, 2013, 6:50 AM
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 NPosted Dec 12, 2013, 6:41 AM
Jignesh TrivediPosted Dec 12, 2013, 6:39 AM
can you please share fnEmpView function code so that we can verify...?