Lior

Lior

  • NA
  • 24
  • 0

Need to know row number straight from SQLServer table

Oct 28 2010 1:54 PM

Hello all,
In my code I have a DataGridView object. I use it to know the row number when I browse the table.
I actually don't need this DataGridView object! I need to know the row number operation straight from the table located inside my SQL.
How can I do that?
Here is part of the code that utilize the DATAGridView (RaceDGView) and I want to change it accordingly
private void CellEditMethod()
    {
      int a = RaceDGView.Rows.Count;

      DataGridViewRow rowToSelect = RaceDGView.Rows[a - 1];
      rowToSelect.Selected = true;

      rowToSelect.Cells[RaceDGView.SelectedCells[0].RowIndex].Selected = true;
      RaceDGView.CurrentCell = rowToSelect.Cells[RaceDGView.SelectedCells[0].RowIndex];
      AddRowPositionLbl.Text = "Added row number is: " + Convert.ToString(RaceDGView.SelectedCells[0].RowIndex+1);
      RaceDGView.BeginEdit(true);
      
    }

PLZ HLP.


Answers (25)