I am using DataAdapter("SDM_Tran_GenerateInvoice") inside DataSet("SDMDAL.xsd") in my project.
Below is the structure of DataAdapter along with the Stored Procedure names in it:
Below is the Table structure Im using for the same:
I am calling this DataAdapter inside Class file named as 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
}
and then calling the SelectInvoice() function of class file inside Default.aspx.cs page, to display records in RadGrid:
protected void rgInvoice_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
rgInvoice.DataSource = SDM.Invoice.GetInvoiceBillingBySPID(lblId.Text);
}
Below is the GetInvoiceBillingBySPID(_SPID) Stored Procedure
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
but when I run Default.aspx page, everytime I get below error at line
return Adapter.GetInvoiceBillingBySPID(_SPID);
Below is the code of the location it is showing in the Error Snapshot - Source File:
Please note that I am very new in DataAdapter and Asp.Net (C#).
Please let me know what mistake I am doing in my code And what does this error mean ? Please reply in simple way so that I can understand.
Thanks in advance