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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:00:02+00:00 2026-06-06T14:00:02+00:00

I have my <asp:GridView ID=gridView runat=server> I bind it like this : myConnection.Open(); SqlCommand

  • 0

I have my <asp:GridView ID="gridView" runat="server"> I bind it like this :

        myConnection.Open();
        SqlCommand myCommand = myConnection.CreateCommand();
        myCommand.CommandType = CommandType.StoredProcedure;
        myCommand.CommandText = "sp_SelectWeek";

        myCommand.Parameters.AddWithValue("@Division", Convert.ToInt32(e.PostBackValue));
        SqlDataReader myReader = myCommand.ExecuteReader();
        myReader.Read();

        gridView.DataSource = myReader;
        gridView.DataBind();

        myReader.Close();
        myConnection.Close();`

but when I run it It takes off one rowfrom the query. I’m sure of this because I tried it with a table and all the rows where there. I build a chart from the same query and you clearly see that I have one row missing :

enter image description here

What am I doing wrong ?

  • 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-06T14:00:08+00:00Added an answer on June 6, 2026 at 2:00 pm

    You’re calling

    myReader.Read();
    

    before you pass the reader as a data source. So you moved the record pointer effectively. Thereby losing your one row. Just don’t call Read and you should be good.

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

Sidebar

Related Questions

hi I have this gridview like this. <asp:DropDownList ID=triggerDropDown runat=server AutoPostBack=true onselectedindexchanged=triggerDropDown_SelectedIndexChanged> <asp:GridView ID=myGridView
so I have a GridView like this: <asp:GridView ID=gv runat=server AutoGenerateColumns=False GridLines=None OnRowCommand=gv_RowCommand OnRowDeleting=gv_RowDeleting
In my .aspx page, I have an <asp:GridView runat=server ID=CustomerGridView> control which I bind
I have a list box like this, <asp:ListBox ID=ListBox1 runat=server Height=175px Width=213px> <asp:ListItem Value=all>All</asp:ListItem>
I have a Gridview <asp:GridView ID=GridView1 runat=server Width=400px AutoGenerateColumns=false OnSelectedIndexChanged=GridView1_SelectedIndexChanged1> <Columns> <asp:TemplateField> <ItemTemplate> <asp:CheckBox
I have an Updatepanel and Gridview inside it. <asp:UpdatePanel ID=uplPanel UpdateMode=Conditional runat=server OnLoad=uplPanel_Load> <ContentTemplate>
We have a GridView that bind to some data and it look like this:
I have a GridView in my page : <asp:GridView ID=GridView1 runat=server AllowPaging=True BackColor=White AutoGenerateColumns=False
I have GridView and Button controls nested inside a Panel . <asp:Panel ID=PanelPopUp runat=server>
I have a asp:GridView which contains a asp:TextBox within a TemplateField. I would like

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.