從This question,其答案几乎是我的答案。但我面臨着一些SQL查詢的問題,我有以下的語句在VBDatatable選擇多個條件SQL查詢問題
Dim results As DataRow() = table.Select("A = 'foo' AND B = 'bar' AND C = 'baz'")
我要放置在變量foo, bar and baz
和使用,在上述聲明的變量。
Dim Varfoo As String = "foo"
Dim Varbar As String = "bar"
Dim Varbaz As String = "baz"
我設法在聲明一個變量
Dim results As DataRow() = table.Select("A = " + Varfoo)
但如何與變量插入多個排序表達式?
編輯:我得到了它的維卡斯如下答覆解決;
Dim results As DataRow() = table.Select("A = '" & Varfoo & "' And B = '" & Varbar & "' And C = '" & Varbaz & "'")
你可以參考這個鏈接:有更多的解釋:http://www.csharp-examples.net/dataview-rowfilter/ – wpcoder