当前位置:编程学习 > C#/ASP.NET >>

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

问题代码:
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;
            }
        }
    } 
--------------------编程问答-------------------- 使用(decimal)或(double)强制转换一下Ceiling方法里的参数。 --------------------编程问答-------------------- 谢谢了!问题解决了!!!!!!!!!!!! --------------------编程问答-------------------- 为什么我看不懂啊,呵呵.出丑了不要建议啊 --------------------编程问答-------------------- 学习中...
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,