求助错误处理:在以下方法或属性之间的调用不明确:“System.Math.Ceiling(decimal)”和“System.Math.Ceiling(double)”

zzx_mox 2007-09-27 04:48:04
问题代码:
private void Page_Load(object sender, System.EventArgs e)
{
// Save the search string parameters to String variables
string searchString = Request.QueryString["Search"];
string allWords = Request.QueryString["AllWords"];
string pageNumber = Request.QueryString["PageNumber"];
string productsOnPage = Request.QueryString["ProductsOnPage"];

// Perform the search and get back the number of results
// The search results will be read from ProductsList.ascx
int howManyResults;
howManyResults = Catalog.SearchCatalog(searchString, pageNumber, productsOnPage, allWords);

// Do you have any results?
if (howManyResults == 0)
{
titleLable.Text = "Your search for <font color=red>" + searchString + "</font> generated no results.";
previousLink.Visible = false;
nextLink.Visible = false;
pageNumberLable.Visible = false;
}
else
{
titleLable.Text = "Your search for <font color=red>" + searchString + "</font> generated " + howManyResults.ToString() + " results:";

// Calculate how many pages of results
int howManyPages = (int)Math.Ceiling(howManyResults / (Convert.ToInt32(productsOnPage)));

// Show "Page x of y" text
pageNumberLable.Text = "Page " + pageNumber + " of " + howManyPages.ToString();

// Initialize the "Previous" link
if (pageNumber == "1")
{
previousLink.Enabled = false;
}
else
{
previousLink.NavigateUrl = Request.Url.AbsolutePath + "?Search=" + searchString + "&AllWords=" + allWords + "&PageNumber=" + (Convert.ToInt32(pageNumber) - 1).ToString() + "&ProductsOnPage=" + productsOnPage;
}

// Initialize the "Next" link
if (pageNumber == howManyPages.ToString())
{
nextLink.Enabled = false;
}
else
{
nextLink.NavigateUrl = Request.Url.AbsolutePath + "?Search=" + searchString + "&AllWords=" + allWords + "&PageNumber=" + (Convert.ToInt32(pageNumber) + 1).ToString() + "&ProductsOnPage=" + productsOnPage;
}
}
}
...全文
956 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
风柏杨 2009-02-28
  • 打赏
  • 举报
回复
学习中...
onlyxing 2008-06-11
  • 打赏
  • 举报
回复
为什么我看不懂啊,呵呵.出丑了不要建议啊
zzx_mox 2007-09-27
  • 打赏
  • 举报
回复
谢谢了!问题解决了!!!!!!!!!!!!
北京的雾霾天 2007-09-27
  • 打赏
  • 举报
回复
使用(decimal)或(double)强制转换一下Ceiling方法里的参数。

62,046

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧