asked on
Public Sub GetpassingNfl()
Dim ds As New DataSet
Dim SelectCommand As New SqlCommand
connetionString = "Data Source=tsnappdev01;Initial Catalog=TSN2;User ID=sa;Password=sportsrus"
connection = New SqlConnection(connetionString)
sql = " Select PK_NFLPLAYERSPASS,np.FirstName,np.LastName, t.Fullname,np.PlayerID,np.TeamID, npp.SeasonType,npp.Season,npp.Conference,npp.Att,npp.Comp,npp.Yards,npp.Long,npp.TD,npp.Inter,npp.Sacks,npp.SKYds,npp.Rating FROM NFLPlayersPass npp "
sql += " join NflPlayers np on np.PlayerID = npp.PlayerID join Teams t on t.TeamID = npp.team WHERE"
sql += " npp.Season = " & cmbseason.SelectedText & "Order By np.Lastname"
If cmbseason.Text = "" Then
Exit Sub
End If
connection = New SqlConnection(connetionString)
Try
connection.Open()
adapter = New SqlDataAdapter(sql, connection)
adapter.Fill(ds)
connection.Close()
dvgPass.DataSource = ds.Tables(0)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
Me.dvgPass.RowsDefaultCellStyle.BackColor = Color.Bisque
Me.dvgPass.AlternatingRowsDefaultCellStyle.BackColor = Color.Beige
dvgPass.ColumnHeadersHeight = 55
dvgPass.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize
Me.dvgPass.RowsDefaultCellStyle.BackColor = Color.Bisque
Me.dvgPass.AlternatingRowsDefaultCellStyle.BackColor = Color.Beige
dvgPass.ColumnHeadersHeight = 55
dvgPass.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize
' Add the image column to the grid.
' DataGridView1.Columns.Add(imageCol)
dvgPass.Columns("Lastname").Frozen = True
End Sub