In the column "TOTAL" is the result of calculations in sql so that the column is an alias and the column has descending in Sql. So how can I set the rank column datatable can create serial number sequence from number one onwards?
Public Sub filltable2(ByVal dtgrd As Object, ByVal design As String)
Dim publictable As New DataTable
Try
da.SelectCommand = cmd
publictable.Columns.Add(New DataColumn("Rank", GetType(Integer)))
Dim count As Integer = 1
da.Fill(publictable)
dtgrd.DataSource = publictable
Select Case design
Case "trial"
End Select
da.Dispose()
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Information)
End Try
End Sub
Table 1
EMPID | NAME | TOTAL |
---|---|---|
10037 | JACK | 389.11 |
10046 | JOHN | 372.62 |
Desired Result table 1
EMPID | NAME | TOTAL | RANK |
---|---|---|---|
10037 | JACK | 389.11 | 1 |
10046 | JOHN | 372.62 | 2 |