Results 1 to 2 of 2

Thread: How grap the passed value in select where clause ?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    Arrow How grap the passed value in select where clause ?

    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
    Code:
    
     strSQL = "SELECT * From matches Where teamno=2"
    but i want change this part so it grabs any passed value for example
    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

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: How grap the passed value in select where clause ?

    strSQL = "SELECT * From matches Where teamno=" & Request.QueryString("team")

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width