I'm getting error in parameter direction output in sqlce query for paging.
What I have tried:
SELECT ROW_NUMBER() OVER (ORDER BY [invoiceId] desc) AS RowNumber,invoiceId,invoice.customerName,invoice.custId,customerPhone,customerAddress,packageName,packageId,amountIncTax,fromDate,toDate,needTrainer,assignedTrainerName,assignedTrainerId,trainerFromDate,trainerToDate,trainerFeesPerMonth,trainerTotPaid,finalFeeAmountIncTax,discountPerc,discountAmount,finalFeeIncTaxAfterDisc,taxPerc,taxAmount,paidOn,paidAmnt,invoicePrinted into #Results from invoice inner join master_customer on master_customer.custId=invoice.custId WHERE lower('Inv'+(cast(invoiceId as varchar(max)))+' '+invoice.customerName+' '+REPLACE(CONVERT(VARCHAR,fromDate, 106), ' ', '-')+' '+REPLACE(CONVERT(VARCHAR,toDate, 106), ' ', '-')+' ') LIKE +'%' + @SearchTerm + '%';
SELECT @RecordCount = COUNT(*) FROM #Results;
SELECT * FROM #Results WHERE RowNumber BETWEEN(@PageIndex -1) * @PageSize + 1 AND(((@PageIndex -1) * @PageSize + 1) + @PageSize) - 1; DROP TABLE #Results;
and then my parameters are
cmd.Parameters.AddWithValue("@PageSize", pageSize);
cmd.Parameters.AddWithValue("@PageIndex", pageIndex);
cmd.Parameters.AddWithValue("@SearchTerm", searchQuery.ToLower().Trim());
cmd.Parameters.Add("@RecordCount", SqlDbType.Int);
cmd.Parameters["@RecordCount"].Direction = ParameterDirection.Output;
I'm getting error in parameter direction output. but for paging purpose i need it because all example in internet using this type of query for paging.