Is there an other way to get row count other then counting each row?
I search for a word Selected from ComboBox in Access database and when that word is found, I want to know its row number.
Dim strBPSSelection As String
strBPSSelection = "SELECT * FROM Posts WHERE DesignationsList=? "
Dim cmdBPSSelection As OleDbCommand = New OleDbCommand(strBPSSelection, Con)
cmdBPSSelection.Parameters.AddWithValue("@?", DesignationComboBox.Text)
drBPSSelection = cmdBPSSelection.ExecuteReader
If drBPSSelection.Read() Then
I want to know at what row I am standing at so I can use that number to get other data from 2nd column of same table and put it in the textbox.
Dim DadDesignationBPS As OleDbDataAdapter
Dim DstDesignationBPS As New DataSet
DadDesignationBPS = New OleDbDataAdapter("SELECT * FROM Posts", Con)
DadDesignationBPS.Fill(DstDesignationBPS, "Posts")
BPSTextBox.Text = DstDesignation.Tables("Posts").Rows(i)("DesignationsList")
I want the count to replace that I
If e.KeyCode = Keys.Enter Or e.KeyCode = Keys.Tab Then
If DesignationComboBox.Text = "" Or DesignationComboBox.Text = "Chose Designation" Then
DesignationComboBox.SelectionStart = 0
DesignationComboBox.SelectionLength = Len(DesignationComboBox.Text)
Else
Dim drBPSSelection As OleDbDataReader
Con.Open()
Dim strBPSSelection As String
strBPSSelection = "SELECT * FROM Posts WHERE DesignationsList=? "
Dim cmdBPSSelection As OleDbCommand = New OleDbCommand(strBPSSelection, Con)
cmdBPSSelection.Parameters.AddWithValue("@?", DesignationComboBox.Text)
drBPSSelection = cmdBPSSelection.ExecuteReader
If drBPSSelection.Read() Then
BPSTextBox.Text = drBPSSelection("BPSList").ToString
Con.Close()
End If
Con.Close()
BPSTextBox.Enabled = True
BPSTextBox.Focus()
End If
End If