Vb.Net - Total record in descending order

0

IcreatedaprojectinVB.NETinitwhenqueryingthecodeshowsmethetotalregistrythatthecalledonehas,howeverIneedittobeindescendingordersincewhensearchingmyformalwayscarriesthelastrecord.

FollowtheCode-

PrivateSubCarregaTabela()'-----PegaaQtddoregistrodeumchamado-------------stSQL="SELECT COUNT(*) AS QTD FROM  PROVIDENCIA WHERE COD_OCORRENCIA = '" + txtCodOcorrencia.Text.PadLeft(10, "0") + "' "
    comCommand = New OleDb.OleDbCommand(stSQL, conBase)
    comCommand.CommandType = CommandType.Text
    darProvidencia = comCommand.ExecuteReader()

    darProvidencia.Read()
    dtx = Convert.ToInt32(darProvidencia("QTD"))

End Sub 

'----------- Páginação - posição dos botões  ----------------------------------------------------
Private Sub MovimentarRegistro(ByVal e As eRegistro)
    Select Case e
        Case eRegistro.Primeiro

            If posicao > 0 Then posicao -= 1

        Case eRegistro.Ultimo
            If posicao < (dtx - 1) Then posicao += 1
        Case Else
            posicao = dtx - 1
    End Select
End Sub 

Att,

    
asked by anonymous 17.03.2016 / 14:48

1 answer

0

It would be something like:

SELECT COUNT(*), ID FROM TABELA GROUP BY ID ORDER BY ID DESC 
    
05.04.2016 / 20:05