从这个问题,它的答案几乎就是我的答案。但我面临一些 sql 查询问题,我在 VB 中有以下语句
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)
但是如何使用变量插入多个排序表达式?
编辑:我用vikas的回答解决了它,如下所示;
Dim results As DataRow() = table.Select("A = '" & Varfoo & "' And B = '" & Varbar & "' And C = '" & Varbaz & "'")