Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to reload the Datagridview using DataView RowFilter?
Message
From
06/01/2011 02:00:38
 
 
To
All
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
How to reload the Datagridview using DataView RowFilter?
Environment versions
Environment:
VB 9.0
OS:
Windows XP
Database:
MS SQL Server
Miscellaneous
Thread ID:
01494873
Message ID:
01494873
Views:
222
Because i want to do a search page, and user enter the search word then immediately show the data' 
In this time , i can do it, but my question is when user enter the backspace clear the value, value is space, then i want to reload the all 
data in datagridview .... for example , if use enter a then show a all data.... but user backspace clear the a ... then show all data....
Post my code first, my code in one time is ok , but second time is a problem, so i don't know why problem .........

 Private Sub BrandFinder_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
       connection()
          cn.Open()
       Dim ds As DataSet = New DataSet
            txtFinder.Text = ""
            Dim qs As String = "select brand , descr  from brand"
           da = New SqlDataAdapter(qs, cn)
            da.MissingSchemaAction = MissingSchemaAction.AddWithKey
            da.Fill(ds, "Brand")
            dv1 = ds.Tables("Brand").DefaultView
            Me.BrandBindingSource.DataSource = ds.Tables("Brand")
End Sub

 Private Sub txtFinder_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtFinder.TextChanged
        Dim str As String
        Dim findIndex As String
   
            If txtFinder.Text <> "" Then
                dv1.RowFilter = "brand like '" + txtFinder.Text + "%'"
            Else                                                                                 'Question in here begin, and my statement has some problem ?
                connection()
                cn.Open()
                Dim qs As String = "select brand , descr from brand"

                da = New SqlDataAdapter(qs, cn)
                da.MissingSchemaAction = MissingSchemaAction.AddWithKey
                da.Fill(ds, "Brand")
                dv1 = ds.Tables("Brand").DefaultView
                Me.BrandBindingSource.DataSource = ds.Tables("Brand")
                Me.Dg.DataSource = Me.BrandBindingSource


        End If
End sub
Next
Reply
Map
View

Click here to load this message in the networking platform