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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:24:59+00:00 2026-06-13T00:24:59+00:00

I am working on a nested repeater. My issue seems to be at the

  • 0

I am working on a nested repeater. My issue seems to be at the moment, that when I execute my SQL command that no data is returned to the data reader. Even when I run the exact same query (Copy and Pasted) into SQL Server.

My noteDrClient reader does not contain data, it does however know that there are 5 columns in the table. I have no idea what to do at this point or why no data is being passed into the data reader. Can anyone see an obvious problem?

  SqlConnection con = new SqlConnection("Data Source=***;Initial Catalog=*;User   ID=*;Password=*;Integrated Security=False;MultipleActiveResultSets=true;");

Above is my connection string. Please notice that I have Multiple Active Result Sets set to true. I did this because I kept getting errors about my data reader being open, even though it was closed.

   protected void rptList_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        RepeaterItem item = e.Item;
        if ((item.ItemType == ListItemType.Item) ||
            (item.ItemType == ListItemType.AlternatingItem))
        {

            System.Data.Common.DbDataRecord rd = (System.Data.Common.DbDataRecord)e.Item.DataItem;

            Repeater nestedRepeater = e.Item.FindControl("NotesRepeater") as Repeater;
            string FID = rd[0].ToString();


            using (cmd2 = new SqlCommand("SELECT * FROM notes WHERE FID = 1356;", con)) ;

            SqlDataReader noteDrClient = cmd2.ExecuteReader();  //no data is being filled to the data reader... even though this command pulls data in SQL Server Management Studio.

            if (noteDrClient.Read()) {   //bind the repeater if there is data to bind
                    nestedRepeater.DataSource = noteDrClient;
                    nestedRepeater.DataBind();
            }

            noteDrClient.Close();                                   




        }
  • 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-13T00:25:00+00:00Added an answer on June 13, 2026 at 12:25 am

    You’re using statement is disposing the SqlCommand before you have a chance to use it. Additionally, you’re attempting to bind to a DataReader. Get the results from the data reader into a collection of “Note” entities and bind to the collection instead.

            using (SqlCommand cmd2 = new SqlCommand("SELECT * FROM notes WHERE FID = 1356;", con))
            {
    
                using(SqlDataReader noteDrClient = cmd2.ExecuteReader())
                {
    
                    while (noteDrClient.Read()) 
                    {   
                        Note n = new Note();
                        ... get note from data reader
                        notes.Add(n); // add note to collection
                    }
                }
            } 
    
            // bind child
            nestedRepeater.DataSource = notes;       
            nestedRepeater.DataBind();       
    

    Edit:

    You might want to look into the DataAdapter – http://www.mikesdotnetting.com/Article/57/Displaying-One-To-Many-Relationships-with-Nested-Repeaters

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

Sidebar

Related Questions

I'm working with a tree structure in MySQL that is respresented using the nested
I'm trying to get a nested loop working that will display 6 posts with
Looking for help with a tripple nested repeater logic issue I have. Background I
I am working with a two nested data repeaters, and I want to allow
I'm working on a legacy application that is using simple JSPs that are nested
I have several models in nested attributes that I'm working with. I have teams
Can anyone help me parse this complex nested json data? I am working with
I have nested ajax calls that are not working in ie7. They work fine
I'm working on a navigation control. I have nested lists which creates this: What
Good day. Has somebody working solution for deleting asset in nested form in Carrierwave?

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.