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

  • Home
  • SEARCH
  • 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 8172023
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T21:38:59+00:00 2026-06-06T21:38:59+00:00

I am having trouble trying to put in data for this project I’m working

  • 0

I am having trouble trying to put in data for this project I’m working on. I have three GridViews that I want to fill with three sets of data from a query. The code below only generates the three grids; all of them are duplicating the third set.

What I’m trying to do is get the first set and put it into the first grid, get the second set and put it into the second grid, and third set into the third grid.

I don’t know why it is retrieving only the last set. I think it has something to do with the adaptor method?

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        DataTable dt = new DataTable();
        DataTable dt2 = new DataTable();
        DataTable dt3 = new DataTable();
        SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ISALog1ConnectionString"].ToString());
        SqlCommand cmd = new SqlCommand("exec ProxyReport", conn);
        cmd.CommandTimeout = 200;
        SqlDataAdapter ad = new SqlDataAdapter(cmd);
        ad.Fill(dt);
        ad.Fill(dt2);
        ad.Fill(dt3);

        GridView1.DataSource = dt;
        GridView1.DataBind();
        GridView2.DataSource = dt2;
        GridView2.DataBind();
        GridView3.DataSource = dt3;
        GridView3.DataBind();
    }
}

Here is what it is getting, it is getting the last set at the bottom and duplicating that one 3 times. I understand the the code does the same thing which is why it duplicates, but why the third set and not the first or middle one? How do i get the first grid to have the first set, and the second to have second set?

enter image description here

  • 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-06T21:39:01+00:00Added an answer on June 6, 2026 at 9:39 pm

    try with dataset, and get datatable from dataset.

    DataSet dataSet = new DataSet();
    SqlDataAdapter ad = new SqlDataAdapter(cmd);
            ad.Fill(dataSet);
    
            GridView1.DataSource = dataset.Tables[0];
            GridView1.DataBind();
            GridView2.DataSource = dataset.Tables[1];
            GridView2.DataBind();
            GridView3.DataSource = dataset.Tables[2];
            GridView3.DataBind();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I`m having trouble trying to optimize this query with OVER (PARTITION BY ...) because
i'm having trouble trying to define this function-like macro, which takes 4 vector magnitudes
I am having trouble trying to get iterators for inner sub-containers. Basically imagine this
I am having trouble getting my UITableViewController to reload/refresh the data. I have a
I am working on a project and having trouble with my UL>LI style. i
Having some trouble trying to put together a page where images are placed properly.
I have a sketch that I want to put up on my website, and
I'm having trouble with the <target> tag in my WPF project. What I'm trying
Ok, I'm having trouble finding an answer to this that isn't just use JSON
I having trouble trying to put a div with the style catalog at the

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.