Hi guys i am passing a aspx page with teamno value( teamsandmatchs.aspx?team=2 ) I do not know how i can grap that passed value and place it inside my select where clasue statement. Right now my where clause has default value 2
but i want change this part so it grabs any passed value for exampleCode:strSQL = "SELECT * From matches Where teamno=2"
teamsandmatchs.aspx?team=4. i be happy if some one show me how i can grap that value and place in my select where clause.Thanks.
Here is my onload code
Code:Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If Session("login") = "ok" Then MyConnection = New SqlConnection("server=localhost;database=teniss2;uid=web;pwd=web;") If Not Page.IsPostBack Then BindDataGridTeams() End If Else Server.Transfer("promptloging.aspx") End If End Sub Sub BindDataGridTeams() Dim ds As New DataSet Dim sda As SqlDataAdapter Dim strSQL As String 'Here we are reciving the teamno value strSQL = "SELECT * From matches Where teamno=2" sda = New SqlDataAdapter(strSQL, MyConnection) sda.Fill(ds, "teams") DataGridTeams.DataSource = ds.Tables("teams") Try DataGridTeams.DataBind() Catch ObjError As Exception DataGridTeams.CurrentPageIndex = 0 DataGridTeams.DataBind() Exit Try End Try End Sub


Reply With Quote
