Click here to Skip to main content
15,896,505 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello



I have used bellow stored procedure by linq and it returns error.

Please help

Error:

internal double ap_InventoryByMakeModel_Count(string make, string model, ref int count)
{
throw new NotImplementedException();
}


--------------------------------------------------

Stored procedure:
SQL
create proc ap_InventoryByMakeModel_Count
  @Make varchar(50) = null, -- criteria
  @Model varchar(50) = null, -- criteria
    @Count int output

as


select @Count = count(*)
from dbo.InventorySum
where Make like @Make
and Model like @Model

return


---------------------------------

C#
namespace WebApplication3
{
    public partial class WebForm2 : System.Web.UI.Page
    {
        protected int currentPageNumber = 1;
        private const int PAGE_SIZE = 25;
        
         private void BindData()
        {
            int count=0;
            string make = Request.QueryString["param1"];
            string model = Request.QueryString["param2"];
            DataClasses1DataContext asset = new DataClasses1DataContext();
            var query = asset.ap_InventoryByMakeModel_Quick3(make, model, 444, 1);
            GridView1.DataSource = query;
            GridView1.DataBind();
            double totalRows = asset.ap_InventoryByMakeModel_Count(make, model,ref count);


            lblTotalPages.Text = CalculateTotalPages(totalRows).ToString();

            lblCurrentPage.Text = currentPageNumber.ToString();

            if (currentPageNumber == 1)
            {
                Btn_Previous.Enabled = false;

                if (Int32.Parse(lblTotalPages.Text) > 0)
                {
                    Btn_Next.Enabled = true;
                }
                else
                    Btn_Next.Enabled = false;

            }

            else
            {
                Btn_Previous.Enabled = true;

                if (currentPageNumber == Int32.Parse(lblTotalPages.Text))
                    Btn_Next.Enabled = false;
                else Btn_Next.Enabled = true;
            }


        }

         private int CalculateTotalPages(double totalRows)
         {
             int totalPages = (int)Math.Ceiling(totalRows / PAGE_SIZE);

             return totalPages;
         }
         protected void ChangePage(object sender, CommandEventArgs e)
         {

             switch (e.CommandName)
             {
                 case "Previous":
                     currentPageNumber = Int32.Parse(lblCurrentPage.Text) - 1;
                     break;

                 case "Next":
                     currentPageNumber = Int32.Parse(lblCurrentPage.Text) + 1;
                     break;
             }

             BindData();
         }

         protected void Page_Load(object sender, EventArgs e)
         {
             BindData();
         }
    }
   

}
Posted
Updated 7-Feb-12 8:24am
v3
Comments
zyck 7-Feb-12 11:20am    
how do your pass value to param1 and param2 by url?

check this if has value
string make = Request.QueryString["param1"];
string model = Request.QueryString["param2"];

1 solution

You know that your error is in a method that throws an exception, right ?
 
Share this answer
 
Comments
masoud_sedighy 7-Feb-12 11:33am    
thanks
sorry actually i do not know this type of error. what i have done is :in webform1 i have used to text boxes and 1 button and then i used this click event in that for opening webfrom2.

protected void Button1_Click(object sender, EventArgs e)
{
string make = TextBox1.Text;
string model = TextBox2.Text;
Response.Redirect(string.Format("~/webform2.aspx?param1={0}¶m2={1}", make, model));


}
Christian Graus 7-Feb-12 12:07pm    
Nevertheless, the method you posted throws an exception and does not do anything....

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900