[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 241
  • Last Modified:

working with dataview

I'm trying to filter a table in a dataset that has 2 tables  (table A, and table B)
I want to to filter table B based on a value from a text box that contains a value from table A

table B is bound to a dataGrid

here is what I have so far

        dv = New DataView(Ds151.Tables.Item("B")) 'dataView for table B
        Dim val As Int32 'val is used to store value from table A
        val = txtNumber.Text()
        dv.RowFilter = "DNO = 'val'" 'filter string

where I'm getting lost is how to set the filter string
0
Orlando15767
Asked:
Orlando15767
  • 4
  • 3
1 Solution
 
iboutchkineCommented:
Dim dv As New DataView()
        With dv
            .Table = ds.Tables(0)
            .RowFilter = "DNO like '" & TextBox1.Text & "%'"
        End With
        dg.DataSource = dv
0
 
Orlando15767Author Commented:
one question, what is dg.DataSource ?
0
 
iboutchkineCommented:
dg - the datagrid name.
it means theat dataview will be the datasource of the datagrid
0
Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

 
Orlando15767Author Commented:
ok

my datagrid has all the column names in it but no rows

there is good data in the table which sould be showing in the grid
any ideas?
0
 
iboutchkineCommented:
it means that datasource has no records after filtering
0
 
Orlando15767Author Commented:
would it matter that text in the textbox is a number being filtered on a number in the table?
0
 
iboutchkineCommented:
it matters
If it is strng yhen your expression will be

  dv.RowFilter = "DNO = '" & textbox1.text & "'"

if it is number then

  dv.RowFilter = "DNO = " & Ctype(textbox1.text, Integer) ' convert  to the right number datatype - double  etc
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now