执行存储过程时出现问题 [英] Problem in implementing stored procedure
本文介绍了执行存储过程时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好
我已经使用了linq的波纹管存储过程,但返回错误.
请帮忙
错误:
内部double ap_InventoryByMakeModel_Count(字符串生成,字符串模型,引用整数计数)
{
抛出新的NotImplementedException();
}
--------------------------------------------------
存储过程:
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:
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
---------------------------------
---------------------------------
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();
}
}
}
推荐答案
您知道您的错误是在引发异常的方法中,对吗?
You know that your error is in a method that throws an exception, right ?
这篇关于执行存储过程时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文