经多次测试,发现Datatable的SQLGetValues方法在MSSQL环境中存在Bug,具体测试过程如下:1.创建MSSQL类型的数据表Orders,其中custid列为文本类型,共有4个无重复的值,样式如下

此主题相关图片如下:a.png

2.获取custid列无重复的内容集合,并按照custid列内容排序:Dim dt As DataTable = DataTables("Orders")
Dim lst As List(of String) = dt.SQLGetValues("custid","custid Is Not Null","custid")
Output.Show(lst.Count)
执行结果为0

此主题相关图片如下:b.png

3.获取custid列无重复的内容集合,不使用排序参数:
Dim dt As DataTable = DataTables("Orders")
Dim lst As List(of String) = dt.SQLGetValues("custid","custid Is Not Null")
Output.Show(lst.Count)
执行结果为4

此主题相关图片如下:c.png

结论:SQLGetValues在MSSQL环境中使用第三个参数与第一个参数相同时,会得出错误结果。
备注:Access数据源测试未发现此Bug