Friday, 18 November 2016

Change SelectCommand during Runtime in VB.NET

Hi All,

If you want to Change SelectCommand during Runtime in VB.NET use the code below in the page where the grid is placed.

Partial Class Main
    Inherits System.Web.UI.Page
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
        Dim qrystring As String
        qrystring = "U"
       
        SqlDataSource1.SelectCommand = "SELECT [HUPName],[HUPPass] FROM                   
        [HUPTable] where HUPName like '%" & qrystring & "%'"
     
        GridView1.DataBind()
    
    End Sub
End Class


No comments:

Post a Comment