问题很简单,当@docount为0时,“发生类型 int 的算术溢出错误,值 =2102021000151.000000
@docount为1时就一点问题也没有CREATE procedure CompanyTable_GetSearchResult
(@skey NVarChar(100),
@pagesize int,
@pageindex int,
@docount bit)
as
set nocount on
if(@docount=1)
select count(id) from CompanyTable where coname like '%'+@skey+'%' and cointro is not null and 主营产品 <>'' and netaddress<>''
else
begin
declare @indextable table(id int identity(1,1),nid int)
declare @PageLowerBound int
declare @PageUpperBound int
set @PageLowerBound=(@pageindex-1)*@pagesize
set @PageUpperBound=@PageLowerBound+@pagesize
set rowcount @PageUpperBound
insert into @indextable(nid) select [id] from CompanyTable where coname like '%'+@skey+'%' and cointro is not null and 主营产品 <>'' and netaddress<>'' order by 诚信指数 desc
select O.id,O.coName,O.cointro,O.主营产品,O.在线图片,O.NetAddress,O.网址图片,O.诚信值,O.诚信指数
from CompanyTable O,@indextable t
where O.id=t.nid
and t.id>@PageLowerBound and t.id<=@PageUpperBound order by t.id
end
set nocount off
GO
@docount为1时就一点问题也没有CREATE procedure CompanyTable_GetSearchResult
(@skey NVarChar(100),
@pagesize int,
@pageindex int,
@docount bit)
as
set nocount on
if(@docount=1)
select count(id) from CompanyTable where coname like '%'+@skey+'%' and cointro is not null and 主营产品 <>'' and netaddress<>''
else
begin
declare @indextable table(id int identity(1,1),nid int)
declare @PageLowerBound int
declare @PageUpperBound int
set @PageLowerBound=(@pageindex-1)*@pagesize
set @PageUpperBound=@PageLowerBound+@pagesize
set rowcount @PageUpperBound
insert into @indextable(nid) select [id] from CompanyTable where coname like '%'+@skey+'%' and cointro is not null and 主营产品 <>'' and netaddress<>'' order by 诚信指数 desc
select O.id,O.coName,O.cointro,O.主营产品,O.在线图片,O.NetAddress,O.网址图片,O.诚信值,O.诚信指数
from CompanyTable O,@indextable t
where O.id=t.nid
and t.id>@PageLowerBound and t.id<=@PageUpperBound order by t.id
end
set nocount off
GO
解决方案 »
- 在线等——这段jquery代码单独放在一个JS文件中怎么就不行了?
- access的传参模糊查询
- 紧急 连接虚拟主机 SQL SEVER 问题?
- 在asp.net中怎样把地址栏中的地址编成乱码呢?
- 问一个发送邮件程序的小问题
- 如何在自定义Web控件中保持状态(此自定义控件继承于WebControl)?
- 为什么得到分没给我加上?(斑竹请回答)
- asp.net中怎么样实现确认对话框?例如我删除时要用户确认是否册除? 根据用户的不同选择作不同处理
- csdn的管理员请看
- 对asp.net非常茫然,不知所措?高手指点,来着有分!
- 如何在page_load中判断是哪个对象产生的事件?
- 如何实现javascript和c#之间的数据共享
应该是运算过程的一些中间表达式产生的值,
我以前好像遇到过这样的问题:bigint=int+int,如果这两个int型数只和超过了int型的范围都会报错,要改成bigint=bigint+bigint才OK~
在查询分析器中可以显示的数据在程序中却显示不到repeart中,这是怎么回事?程序中调用存储过程的代码:
private void Page_Load(object sender, System.EventArgs e)
{
//页面初始化时进行数据绑定
SqlConnection conn=new SqlConnection(Class.DataAccess.ConnectionStrBySql );
if(!IsPostBack)
{
ViewState["QueryStr"] =Request["sf"]; cmd=new SqlCommand("CompanyTable_GetSearchResult",conn);
cmd.CommandType=CommandType.StoredProcedure;
cmd.Parameters.Add("@skey","+strsql+");
cmd.Parameters.Add("@pagesize",1);
cmd.Parameters.Add("@pageindex",1);
cmd.Parameters.Add("@docount",true);
conn.Open();
pager.RecordCount=(int)cmd.ExecuteScalar();
conn.Close();
Bind();
}
}private void Bind()
{
string strsql = ViewState["QueryStr"] as string;
SqlConnection conn=new SqlConnection(Class.DataAccess.ConnectionStrBySql );
cmd=new SqlCommand("CompanyTable_GetSearchResult",conn);
cmd.CommandType=CommandType.StoredProcedure;
cmd.Parameters.Add("@skey","+strsql+");
cmd.Parameters.Add("@pagesize",pager.PageSize);
cmd.Parameters.Add("@pageindex",pager.CurrentPageIndex);
cmd.Parameters.Add("@docount",false);
conn.Open();
RepeaterTem1.DataSource=cmd.ExecuteReader();
RepeaterTem1.DataBind();
conn.Close();
}