why procedure parameter searchstring work from SQL but on csharp not work ?

  • Thread starter Thread starter engahmedbarbary
  • Start date Start date
E

engahmedbarbary

Guest
why procedure parameter searchstring work from SQL but on csharp not work ?

when pass value to paramter name searchstring as following

'Text6=''locations'''

it not work and give me error

An expression of non-boolean type specified in a context where a condition is expected, near 'and'.



although when pass it to SQL as below it work success

exec [dbo].[sp_ReportDetailsGetALL] "2028","2020-05-03","2020-05-11", 'Text6=''locations'''


public DataTable GetReportDetailsSearch(string ReportID, string FromDate, string ToDate, string SearchString)
{

List<SqlParameter> param = new List<SqlParameter>()
{
new SqlParameter("@ReportID", ReportID),
new SqlParameter("@ReportDateFrom", FromDate),
new SqlParameter("@ReportDateTo", ToDate),
new SqlParameter("@SearchString",SearchString),


};

DataTable ReportDetailsSearch = SQLDAL.ReturnDataTableByProcedure("sp_ReportDetailsGetALL", param);
return ReportDetailsSearch;
}

Continue reading...
 
Back
Top