Click here to Skip to main content
15,887,350 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HI , In my project when i fetch record on the web sever then it give the error, Cannot find Table 0' but on the local server this is running in proper way, this is not give any error on the local sever, I am using dot net framwork 2.0' and database sql sever 2005 on the my local server.
Can any one help please, this is urgent..
Thanks in advance.
this is the code for radio button..
protected void rbtnTax_CheckedChanged(object sender, EventArgs e)
    {
        if (rbtnTax.Checked == true)
        {
            rbtnSale.Checked = false;
            enablecontrols();
            lblSaleTax.Text = "TAX INVOICE";
            FillBookInvoiceNoTax();
        }
    }

//...this is  the method...............
public void FillBookInvoiceNoTax()
    {
        DataSet dsBook = new DataSet();
        int BookNo = 0;
        int InvoiceNo = 0;

        dsBook = oAdmin.GetBookNoInvoiceNoTax1();

        string BNo = dsBook.Tables[0].Rows[0][1].ToString();
        string INo = dsBook.Tables[0].Rows[0][0].ToString();

        if (BNo == "" && INo == "")
        {

            DataSet DsBI = new DataSet();
            DsBI = oAdmin.GetBookNoInvoiceNoTax();
            BookNo = Convert.ToInt32(DsBI.Tables[0].Rows[1]["BookNo"].ToString());
            InvoiceNo = Convert.ToInt32(DsBI.Tables[0].Rows[1]["InvoiceNo"].ToString());
            InvoiceNo = InvoiceNo - 1;



        }
        else
        {
            BookNo = Convert.ToInt32(BNo);
            InvoiceNo = Convert.ToInt32(INo);
        }


        if (BookNo == 0 && InvoiceNo == 0)
        {
            BookNo = 1;
            InvoiceNo = 1;
            lblBookNoS.Text = BookNo.ToString();
            lblInvoiceNoS.Text = InvoiceNo.ToString();
        }

        else if (InvoiceNo % 50 == 0)
        {
            BookNo = BookNo + 1;
            InvoiceNo = InvoiceNo + 1;
            lblBookNoS.Text = BookNo.ToString();
            lblInvoiceNoS.Text = InvoiceNo.ToString();
        }
        else
        {
            InvoiceNo = InvoiceNo + 1;
            lblBookNoS.Text = BookNo.ToString();
            lblInvoiceNoS.Text = InvoiceNo.ToString();
        }

    }
//...............this is the claas which i am using..............
 public DataSet GetBookNoInvoiceNoTax()
        {
            DataSet oDs = null;
            SqlDataReader oDR;
            string strSPName;

            try
            {
                strSPName = "GetBookInvoice ";

                oDs = oDU.GetDataSetProc(strSPName);
                return oDs;
            }
            catch
            {
                return oDs;
            }
        }
//..............this is the second class..............
         public DataSet GetBookNoInvoiceNoTax1()
        {
            DataSet oDs = null;
            SqlDataReader oDR;
            string strSPName;

            try
            {
                strSPName = "GetInvoceTaxpurchase ";

                oDs = oDU.GetDataSetProc(strSPName);
                return oDs;
            }
            catch
            {
                return oDs;
            }
        }
//.............this is the stotr  procedure first..................
ALTER PROCEDURE [dbo].[GetInvoceTaxpurchase]
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

    -- Insert statements for procedure here
	SELECT max(InvoiceNo), max(BookNo)
        FROM [Inventry].[dbo].[BookInvoiceTax]
END
//....this is the second procedure.............
ALTER PROCEDURE [dbo].[GetBookInvoice]
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

    -- Insert statements for procedure here
	SELECT * from SetBookInvoice
END
Posted
Updated 6-Oct-11 20:19pm
v3
Comments
hitech_s 7-Oct-11 1:11am    
plz post your code then i will try to give the solution
hitech_s 7-Oct-11 7:21am    
place breakpoint in this function
FillBookInvoiceNoTax()

debug it you will get it easily

Looks like the query did not return anything. Check first if the the dataset contains any tables at all before accessing any.

debug your code and check if dataset return any value.
 
Share this answer
 
This is the solution for this error
SQL
ALTER PROCEDURE [dbo].[GetInvoceTaxpurchase]
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;
 
        -- Insert statements for procedure here
	SELECT max(InvoiceNo), max(BookNo)
        FROM BookInvoiceTax
END
 
Share this answer
 
v2

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