使用事务,一次性提交
http://www.foxtable.com/webhelp/scr/2933.htm
或者组合sql语句,一次性查询,不然多次查询会很耗,如
Dim st As Date = Date.Now
Dim mc As String
Dim cmd As New SQLCommand
Dim dt As DataTable
Dim str As String = ""
For Each c As DataCol In DataTables("表A").DataCols
If c.IsString = True Then
mc = c.name
str &= "Select Count(*) as 数量 From {表A} Where " & mc & " = '" & "查找的字符" & "' union all "
End If
Next
str = str.substring(0, str.length-10)
msgbox(str)
cmd.CommandText = str
dt = cmd.ExecuteReader
For i As Integer = 0 To dt.datarows.count-1
output.show(i & " " & dt.datarows(i)(”数量"))
next