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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:58:01+00:00 2026-06-11T00:58:01+00:00

This is what I am trying to achieve : I have a table in

  • 0

This is what I am trying to achieve :

I have a table in a database in which there is a column named “item_code”.

I need to query this table, returning ONE row at a time. Now, I need to use the value of the column “item_code” for the one row which has been returned to query ANOTHER table where I’ll use it to fetch a bunch of row(s). How do I do this?

I tried using a datareader object in a while loop, fetch one row at a time and then query the other table inside this loop to fetch the rows required but I couldn’t figure out how to put this data in a gridview (use datatable? if yes, how?) in such a way that the previous rows in the gridview don’t get erased after each iteration of the while loop.

The only way I know for putting data into a gridview is by using .Fill() but obviously, Fill method wouldn’t do in this case as it would wipe out the previous entries in the gridview.

Please help.

  • 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-11T00:58:03+00:00Added an answer on June 11, 2026 at 12:58 am

    Your solution will work, but you are correct, Fill() will erase the contents of the table. Instead, use Merge()

    var myMainTable = new DataTable();
    
    foreach(var itemId in itemIds)
    {
      var currentTable = new DataTable();
      // submit new query
      myAdapter.Fill(currentTable)
      myMainTable.Merge(currentTable);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to achieve this using Expression Blend 3. I need that every
I am trying to setup a simple database in which I have a user
In a MySQL database, I have a table which contains itemID, itemName and some
This is what I am trying to achieve: if a property is set then
I am trying to achieve something like this. The Expandable List consists of the
I'm trying to achieve what this guy here is doing, only in PHP or
I am trying to achieve this effect where a photo gets a repeating pattern
I'm trying to achieve URLs like this in Rails: http://localhost/posts/1234/post-slug-name with both ID and
this is the scenario i'm trying to achieve: a sound stored on the same
I'm trying to achieve something similar to jQuery Glow or this fiddle . Specifically

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.