sqlce中的参数方向输出问题

sqlce中的参数方向输出问题

本文介绍了sqlce中的参数方向输出问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在sqlce查询中输入参数方向输出错误。



我尝试过:



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.

推荐答案

int recordcount= (int)cmd.ExecuteScalar();



谢谢


Thanks


这篇关于sqlce中的参数方向输出问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 10:27