sqlce中的参数方向输出问题 [英] Parameter direction output problem in sqlce

查看:64
本文介绍了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.

推荐答案

你好,

输出参数是SqlCe不支持。而不是那样,你可以使用 ExecuteScalar 方法。

Hello ,
Output Parameter is not supported in SqlCe . Instead of that , you may use ExecuteScalar method .
int recordcount= (int)cmd.ExecuteScalar();



谢谢


Thanks


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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆