title: Vb.net data misplaced
body: <p>Using visual studio 2010 I'm developing an vb.net application in which I need to store more than 10000 records in a table. The table format is</p>
  
  <pre><code>|empno |year |january|february| march |april |may |june |july |august |September |october |november  |december| total|
  </code></pre>
  
  <p>Sample data:</p>
  
  <pre><code>101 2010 10000 15000 25000
  101 2011 15000 20000 35000
  101 2012 20000 25000 45000
  101 2013 25000 30000 55000
  102 2008 1000  1500  2500
  102 2009 1500  2000  3500
  102 2010 10000 15000 25000
  102 2011 15000 20000 35000
  102 2012 20000 25000 45000
  102 2013 25000 30000 55000
  </code></pre>
  
  <p>Now the problem is when I'm inserting the data into this table, it doesn't stored properly. I mean, It seems to be</p>
  
  <pre><code>102 2012 20000 25000 45000
  101 2010 10000 15000 25000
  101 2011 15000 20000 35000
  101 2012 20000 25000 45000
  101 2013 25000 30000 55000
  102 2008 1000  1500  2500
  102 2009 1500  2000  3500
  102 2010 10000 15000 25000
  102 2011 15000 20000 35000
  102 2013 25000 30000 55000
  </code></pre>
  
  <p>In every set of data one of the year's record is stored at the top of the table. So, when I'm displaying records for a particular employee, it doesn't display it properly(I mean not in the order). Ex: for empno 102, the result is like</p>
  
  <pre><code>102 2012 20000 25000 45000
  102 2008 1000  1500  2500
  102 2009 1500  2000  3500
  102 2010 10000 15000 25000
  102 2011 15000 20000 35000
  102 2013 25000 30000 55000
  </code></pre>
  
  <p>I think Sorting by year is not a solution. Because, it has many records for a year.</p>
  
  <p>I checked for all the records. Only some of the record having this problem. I don't know anything about this problem and how to solve it. Can anyone what is the reason for this and how to avoid?</p>
  
  <p>Thanks in advance</p>
  
  <p>Edit: Code</p>
  
  <pre><code>If yodor1 &lt;= 2015 Then
              up = 2015
          ElseIf yodor1 &lt;= 2025 Then
              up = 2025
          ElseIf yodor1 &lt;= 2035 Then
              up = 2035
          ElseIf yodor1 &lt;= 2045 Then
              up = 2045
          End If
  
          con.Open()
          txt = "select * from pension where empno='" &amp; TextBox5.Text &amp; "' "
          cmd = New SqlCommand(txt, con)
          reader = cmd.ExecuteReader()
          While reader.Read
              If yodor1 &lt;= up Then
                  flag = False
                  display2.grid1.set_TextMatrix(a, 0, reader("year"))
                  display2.grid1.set_TextMatrix(a, 1, reader("january"))
                  display2.grid1.set_TextMatrix(a, 2, reader("february"))
                  display2.grid1.set_TextMatrix(a, 3, reader("march"))
                  display2.grid1.set_TextMatrix(a, 4, reader("april"))
                  display2.grid1.set_TextMatrix(a, 5, reader("may"))
                  display2.grid1.set_TextMatrix(a, 6, reader("june"))
                  display2.grid1.set_TextMatrix(a, 7, reader("july"))
                  display2.grid1.set_TextMatrix(a, 8, reader("august"))
                  display2.grid1.set_TextMatrix(a, 9, reader("septemper"))
                  display2.grid1.set_TextMatrix(a, 10, reader("october"))
                  display2.grid1.set_TextMatrix(a, 11, reader("november"))
                  display2.grid1.set_TextMatrix(a, 12, reader("december"))
                  a = a + 1
                  yodor1 = yodor1 + 1
              ElseIf yodor1 &lt;= (up + 10) Then
                  flag = False
                  display2.grid2.set_TextMatrix(b, 0, reader("year"))
                  display2.grid2.set_TextMatrix(b, 1, reader("january"))
                  display2.grid2.set_TextMatrix(b, 2, reader("february"))
                  display2.grid2.set_TextMatrix(b, 3, reader("march"))
                  display2.grid2.set_TextMatrix(b, 4, reader("april"))
                  display2.grid2.set_TextMatrix(b, 5, reader("may"))
                  display2.grid2.set_TextMatrix(b, 6, reader("june"))
                  display2.grid2.set_TextMatrix(b, 7, reader("july"))
                  display2.grid2.set_TextMatrix(b, 8, reader("august"))
                  display2.grid2.set_TextMatrix(b, 9, reader("septemper"))
                  display2.grid2.set_TextMatrix(b, 10, reader("october"))
                  display2.grid2.set_TextMatrix(b, 11, reader("november"))
                  display2.grid2.set_TextMatrix(b, 12, reader("december"))
                  b = b + 1
                  yodor1 = yodor1 + 1
              ElseIf yodor1 &lt;= (yodor + 19) Then
                  flag = False
                  DISPLAY3.grid2.set_TextMatrix(f, 0, reader("year"))
                  DISPLAY3.grid2.set_TextMatrix(f, 1, reader("january"))
                  DISPLAY3.grid2.set_TextMatrix(f, 2, reader("february"))
                  DISPLAY3.grid2.set_TextMatrix(f, 3, reader("march"))
                  DISPLAY3.grid2.set_TextMatrix(f, 4, reader("april"))
                  DISPLAY3.grid2.set_TextMatrix(f, 5, reader("may"))
                  DISPLAY3.grid2.set_TextMatrix(f, 6, reader("june"))
                  DISPLAY3.grid2.set_TextMatrix(f, 7, reader("july"))
                  DISPLAY3.grid2.set_TextMatrix(f, 8, reader("august"))
                  DISPLAY3.grid2.set_TextMatrix(f, 9, reader("septemper"))
                  DISPLAY3.grid2.set_TextMatrix(f, 10, reader("october"))
                  DISPLAY3.grid2.set_TextMatrix(f, 11, reader("november"))
                  DISPLAY3.grid2.set_TextMatrix(f, 12, reader("december"))
                  f = f + 1
                  yodor1 = yodor1 + 1
              ElseIf yodor1 &lt; (yodor + 30) Then
                  flag = False
                  DISPLAY3.grid1.set_TextMatrix(c, 0, reader("year"))
                  DISPLAY3.grid1.set_TextMatrix(c, 1, reader("january"))
                  DISPLAY3.grid1.set_TextMatrix(c, 2, reader("february"))
                  DISPLAY3.grid1.set_TextMatrix(c, 3, reader("march"))
                  DISPLAY3.grid1.set_TextMatrix(c, 4, reader("april"))
                  DISPLAY3.grid1.set_TextMatrix(c, 5, reader("may"))
                  DISPLAY3.grid1.set_TextMatrix(c, 6, reader("june"))
                  DISPLAY3.grid1.set_TextMatrix(c, 7, reader("july"))
                  DISPLAY3.grid1.set_TextMatrix(c, 8, reader("august"))
                  DISPLAY3.grid1.set_TextMatrix(c, 9, reader("septemper"))
                  DISPLAY3.grid1.set_TextMatrix(c, 10, reader("october"))
                  DISPLAY3.grid1.set_TextMatrix(c, 11, reader("november"))
                  DISPLAY3.grid1.set_TextMatrix(c, 12, reader("december"))
                  c = c + 1
                  yodor1 = yodor1 + 1
              End If
          End While
          reader.Close()
          con.Close()
  </code></pre>