我在项目中的DataSet(“SDMDAL.xsd”)中使用DataAdapter(“SDM_Tran_GenerateInvoice”)。
我在类文件中将此DataAdapter称为 SDM.InvoiceBLL.cs :
using SDMDALTableAdapters;
public class SDM_Invoice
{
private SDM_Tran_GenerateInvoiceTableAdapter _GenerateInvoiceTableAdapter = null;
protected SDM_Tran_GenerateInvoiceTableAdapter Adapter
{
get
{
if (_GenerateInvoiceTableAdapter == null)
_GenerateInvoiceTableAdapter = new SDM_Tran_GenerateInvoiceTableAdapter();
return _GenerateInvoiceTableAdapter;
}
}
#region GET
public SDMDAL.SDM_Tran_GenerateInvoiceDataTable SelectInvoice(string _SPID)
{
return Adapter.SelectInvoice(_SPID); }
public SDMDAL.SDM_Tran_GenerateInvoiceDataTable GetInvoiceBillingBySPID(string _SPID)
{
return Adapter.GetInvoiceBillingBySPID(_SPID); //getting error for this Stored Procedure
}
public SDMDAL.SDM_Tran_GenerateInvoiceDataTable GetInvoiceID()
{
return Adapter.GetInvoiceID();
}
public SDMDAL.SDM_Tran_GenerateInvoiceDataTable GetInvoiceNumber()
{
return Adapter.GetInvoiceNumber();
}
#endregion
}
然后在 Default.aspx.cs 页面中调用类文件的 SelectInvoice()函数,以在RadGrid中显示记录:
protected void rgInvoice_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
rgInvoice.DataSource = SDM.Invoice.GetInvoiceBillingBySPID(lblId.Text);
}
以下是 GetInvoiceBillingBySPID(_SPID)存储过程
ALTER PROCEDURE [dbo].[SDM_Select_BillingBySPID_Invoice]
@SPID as nvarchar(50)
AS
BEGIN
SET NOCOUNT ON;
SELECT
--B.ID,
B.BillingID,
DCIDescription, --
(SELECT BUName FROM dbo.SDM_Master_BU WITH (NOLOCK) WHERE BUID=AfoBUID) as BUName, --
(SELECT BUfoStatusID FROM dbo.SDM_Master_BU WITH (NOLOCK) WHERE BUID=AfoBUID) as BUfoStatusID --
FROM SDM_Tran_Billing B WITH (NOLOCK),
dbo.SDM_Tran_DCI WITH (NOLOCK),
dbo.SDM_Tran_Allocation WITH (NOLOCK)
WHERE B.BfoAllocationID=AllocationID and AfoDCIID=DCIID and DCIfoSPID=@SPID and B.BfoStatusID=1
END
但是当我运行 Default.aspx 页面时,每次我在行return Adapter.GetInvoiceBillingBySPID(_SPID);
以下是错误快照 - 源文件中显示的位置代码:
请注意,我是DataAdapter和Asp.Net(C#)的新手。
请让我知道我在代码中犯了什么错误这个错误是什么意思?请以简单的方式回复,以便我能理解。
提前致谢