Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9219425
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:06:52+00:00 2026-06-18T03:06:52+00:00

I have single DataSet.xsd file and in this i have two DataTable one is

  • 0

I have single DataSet.xsd file and in this i have two DataTable one is Bill and another is BillInfo now, i am fill writing this code

string qry = "Select * from BillInfo where [BillNumber]='" +txtbill.Text + "' and [Session]='"+CLS.ses+"'";
        OleDbDataAdapter da = bm.returnDataAdaptor(qry);
        DataSet ds1 = new DataSet();
        da.Fill(ds1);
        DataSets.Bill ds = new DataSets.Bill();
        da.Fill(ds);
        DataTable Dt1 = ds1.Tables[0];
        DataTable dt = ds.Tables.Add("BillInfo");
        dt.Columns.Add("BillNumber", Type.GetType("System.String"));
        dt.Columns.Add("CustomerName", Type.GetType("System.String"));
        dt.Columns.Add("City", Type.GetType("System.String"));
        dt.Columns.Add("Mobile", Type.GetType("System.String"));
        dt.Columns.Add("TotalAmount", Type.GetType("System.String"));
        dt.Columns.Add("Packing", Type.GetType("System.String"));
        dt.Columns.Add("Tax", Type.GetType("System.String"));
        dt.Columns.Add("Transport", Type.GetType("System.String"));
        dt.Columns.Add("Additional", Type.GetType("System.String"));
        dt.Columns.Add("PaybleAmount", Type.GetType("System.Int32"));
        dt.Columns.Add("Session", Type.GetType("System.String"));
        dt.Columns.Add("Date1", Type.GetType("System.DateTime"));
        dt.Columns.Add("Naration", Type.GetType("System.String"));
        dt.Columns.Add("AmountWord", Type.GetType("System.String"));
        dt.Columns.Add("Status", Type.GetType("System.String"));
        dt.Columns.Add("Balance", Type.GetType("System.Int32"));

        for (int i = 0; i < Dt1.Rows.Count; i++)
        {
            DataRow r = dt.NewRow();
            r["BillNumber"] = Dt1.Rows[i][0];
            r["CustomerName"] = Dt1.Rows[i][1];
            r["City"] = Dt1.Rows[i][2];
            r["Mobile"] = Dt1.Rows[i][3];
            r["TotalAmount"] = Dt1.Rows[i][4];
            r["Packing"] = Dt1.Rows[i][5];
            r["Tax"] = Dt1.Rows[i][6];
            r["Transport"] = Dt1.Rows[i][7];
            r["Additional"] = Dt1.Rows[i][8];
            r["PaybleAmount"] = Dt1.Rows[i][9];
            r["Session"] = Dt1.Rows[i][10];
            r["Date1"] = Dt1.Rows[i][11];
            r["Naration"] = Dt1.Rows[i][12];
            r["AmountWord"] = Dt1.Rows[i][13];
            r["Status"] = Dt1.Rows[i][14];
            r["Balance"] = Dt1.Rows[i][15];
            dt.Rows.Add(r);
        }
        string qry1 = "Select * from BillDetails where [BillNumber]='" + txtbill.Text + "'";
        OleDbDataAdapter da1 = bm.returnDataAdaptor(qry1);
        DataSet ds2 = new DataSet();
        da.Fill(ds2);
        da.Fill(ds);
        DataTable Dt2 = ds2.Tables[0];
        DataTable dt2 = ds.Tables.Add("Bill");
        dt2.Columns.Add("BillNumber", Type.GetType("System.String"));
        dt2.Columns.Add("ProductCode", Type.GetType("System.String"));
        dt2.Columns.Add("ProductName", Type.GetType("System.String"));
        dt2.Columns.Add("productSize", Type.GetType("System.String"));
        dt2.Columns.Add("ProductQuantity", Type.GetType("System.String"));
        dt2.Columns.Add("ProductWeight", Type.GetType("System.String"));
        dt2.Columns.Add("Unit", Type.GetType("System.String"));
        dt2.Columns.Add("ProductPrice", Type.GetType("System.String"));
        dt2.Columns.Add("Amount", Type.GetType("System.String"));
        dt2.Columns.Add("Date1", Type.GetType("System.DateTime"));
        for (int i = 0; i < Dt2.Rows.Count; i++)
        {
            DataRow r = dt.NewRow();
            r["BillNumber"] = Dt2.Rows[i][0];
            r["ProductCode"] = Dt2.Rows[i][1];
            r["ProductName"] = Dt2.Rows[i][2];
            r["productSize"] = Dt2.Rows[i][3];
            r["ProductQuantity"] = Dt2.Rows[i][4];
            r["ProductWeight"] = Dt2.Rows[i][5];
            r["Unit"] = Dt2.Rows[i][6];
            r["ProductPrice"] = Dt2.Rows[i][7];
            r["Amount"] = Dt2.Rows[i][8];
            r["Date1"] = Dt2.Rows[i][9];
            dt2.Rows.Add(r);
        }

but at the r["ProductCode"] = Dt2.Rows[i][1]; it is showing an exception. That is Column 'ProductCode' does not belong to table BillInfo. Please solve my error.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T03:06:53+00:00Added an answer on June 18, 2026 at 3:06 am

    Replace

    DataRow r = dt.NewRow();
    

    with

    DataRow r = dt2.NewRow();
    

    You have simply used the wrong table which has no column ProductCode. It must be “Bill” instead of “BillInfo”.

    Apart from that:

    You are open for sql-injection when you use textboxes as input for your sql query. Use parameters instead.

    http://msdn.microsoft.com/en-us/library/system.data.oledb.oledbparameter.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have one single file called Exercises.rb def ask(prompt) print prompt, ' ' $stdout.flush
I'm writing a program in R. I have a dataset like this: category x-value
I have a single columned datatable inside a single tabled dataset. I just want
This question has two aspects, both related to indices. I have a dataset with
I have two databases, one is an MS Access file, the other is a
I have a DataSet with a DataTable that correctly fills a single DataRow through
I have a single big text file in which I want to process each
I get several Datasets listed in a single xml File. I have to extract
I am writing a code generation tool that will take in a XSD file
I currently have a single DataSet declared which contains 3 tables. For sake of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.