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 8825537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T06:54:11+00:00 2026-06-14T06:54:11+00:00

Friends expecting ur suggetions to the below code. Instead of taking dtr1( DatatableReader) it

  • 0

Friends expecting ur suggetions to the below code. Instead of taking dtr1( DatatableReader) it is taking outside loop dtr(DataTableReader) Table.

protected void GetStudReport(Object o, EventArgs e)
{
    if (mycon.State != ConnectionState.Open)
    {
        List<string> lstQstn = new List<string>();

        mycon.Open();
        cmd = new MySqlCommand("SELECT * from scord_mark_table where stu_ID='" + drpDnSearch3.SelectedValue + "'", mycon);
        MySqlDataReader rdr1=cmd.ExecuteReader();
        DataSet ds=new DataSet();
        DataTable dtScrTbl=new DataTable();
        dtScrTbl.Load(rdr1);
        ds.Tables.Add(dtScrTbl);
        rdr1.Close();
        cmd = null;

        int i = 0;
        Dictionary<string, string> dctSub = new Dictionary<string, string>();
        **using (DataTableReader dtr = ds.CreateDataReader())**
        {
            while (dtr.Read())
            {
                lstQstn.Add(dtr["test_id"].ToString());

                while (i <= lstQstn.Count())
                {
                    MySqlCommand cmd2 = new MySqlCommand("SELECT test_id,subject_id from qution_no_table where test_id='" + lstQstn[i].ToString() + "'", mycon);
                    MySqlDataReader rdr2 = cmd2.ExecuteReader();
                    DataTable dtQsNoTbl = new DataTable();
                    dtQsNoTbl.Load(rdr2);
                    ds.Tables.Add(dtQsNoTbl);

                    **using (DataTableReader dtr1 = ds.CreateDataReader())** 
                    {

                        while (dtr1.Read())
                        {
                            dctSub.Add(dtr1["test_id"].ToString(), dtr1["subject_id"].ToString());    // **here it is taking table scord_mark_table instead of dtr1's qution_no_table** 
                        }
                        rdr2.Close();
                        break;
                    }
                }
                //cmd2 = null;
                i++;


            }

        }
  • 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-14T06:54:12+00:00Added an answer on June 14, 2026 at 6:54 am

    No, it’s not – it’s returning a new DataTableReader hooked to ALL of the existing tables (including the one you created before the first loop).

    Try specifying the DataTable you want the readers attached to:

    using (DataTableReader dtr = ds.CreateDataReader(dtScrTbl))
    

    and

    using (DataTableReader dtr1 = ds.CreateDataReader(dtQsNoTbl))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

friends, i have created custom title bar using following titlebar.xml file with code <?xml
Trying to make a class friends with an extern C function, this code works:
I've recently been exporting my settings from my various IDE's to share with friends.
friends, I am working with UIBezierPaths, for free hand drawing , and everything works
Friends, Can you please give me significance, difference and uses for Heap and PermGen.
friends. I have a 'make'-like style file needed to be parsed. The grammar is
Friends i'm using string builder for generating Passenger List in which i have used
Friends its really giving me a great head ache about the problem I am
Friends, I like to know using which version of Android SDK we can develop
Friends, I have a strange need and cannot think my way through the problem.

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.