Hi,
I cannot seem to figure out how to search through a created/filled dataset for a certain value which exists in column(1), returning Column(0)'s value into a textbox.
My code looks like this:
Dim connStringdg44 As String = "server=(local);database=Cricket;trusted_connection=yes"
Dim conndg44 As New SqlConnection(connStringdg44)
Dim strSQLdg44 As String = "select ROW_NUMBER() OVER (ORDER BY (cast (sum(GamePoints.WinIndicator *100.00)/count(gamePoints.GameID*100.00) as varchar (50)))+'%' DESC) as 'Rank', Team,COUNT(gamePoints.GameID) as 'Played', SUM(GamePoints.WinIndicator) as 'Won',cast (sum(GamePoints.WinIndicator *100.00)/count(gamePoints.GameID*100.00) as varchar (50))+'%' as 'Efficiency' FROM gamePoints INNER JOIN DomesticTeam ON GamePoints.Team = DomesticTeam.DomTeam GROUP BY GamePoints.Team order by 'Efficiency' desc"
Dim dadg44 As New SqlDataAdapter(strSQLdg44, conndg44)
Dim dsdg44 As New DataSet
dadg44.Fill(dsdg44, "DomesticRanking")
conndg44.Close()
The SQL query looks into a current SQL DB, populating the new ds with the following values:
1 Northerns 11 9 81.818181%
2 Natal 10 8 80.000000%
3 Eastern Province 8 5 62.500000%
4 Western Province 8 5 62.500000%
5 Mpumalanga 10 6 60.000000%
6 Boland 7 4 57.142857%
7 ETVL 6 3 50.000000%
8 Gauteng 6 3 50.000000%
9 Griquas 12 6 50.000000%
10 SETVL 8 4 50.000000%
11 Free State 7 3 42.857142%
12 North West 7 3 42.857142%
13 Limpopo 12 5 41.666666%
14 WTVL 8 3 37.500000%
15 Northern Natal 12 3 25.000000%
16 SWD 10 1 10.000000%
All I want to do is to search through the second column for the existence of a value, or "Team" which I have in a combobox, and return the corresponding Rank which is in column 1. My combobox is already populated with the teams from column 2.