根据VB中的其他Datagridview表值过滤Datagridview

时间:2014-09-18 05:35:26

标签: vb.net datagridview

这样的事情可能吗?我有2个datagridview表连接到2个不同的sqladapters和数据集,两者都有totalminutes值。我正在尝试过滤第二个数据网格中与第一个数据网格单元格值具有相同未知值的行。

Dim com1r2 As String = "SELECT * from BITD WHERE time >= '% $DataGridView1.Rows(1).Cells(2).Value $%' "

http://i.stack.imgur.com/1VeRN.jpg

1 个答案:

答案 0 :(得分:0)

感谢您的回复。我终于弄明白了。这符合我的要求。欢呼声。

  Dim tes As Single = DataGridView1.Rows(1).Cells(2).Value - 600
  Dim com1r2 As String
  com1r2 = "Select * from BITD WHERE nama_asal = 'Bandara Husein' AND tipe_tujuan = 'o' AND wkt_buk <= " & Val(tes) & " ORDER BY skr_lok DESC, wkt_jln ASC "
  Dim sqldataadapter1r2 As New SqlDataAdapter(com1r2, con)
  sqldataadapter1r2.Fill(DataSet21, "bitd")
  DataGridView1r2.DataSource = DataSet21.Tables(0)