Public Overloads Function SETData(Table As Tables, Col() As String) As Statuez
Dim DD As New DataSet, State As New Statuez
Try
DD = R.Dset(Table, "Select **col()** from " & Table.TName & " where username='" & Table.User & "'")
DG.DataSource = DD.Tables(0)
State.Done = True
Catch ex As Exception
State.Done = False
State.Message = ex.Message
End Try
Return State
End Function
*** Col()As String是一个数组,包含所需列的名称
有没有办法选择列数组而没有输入数组的每个成员?
答案 0 :(得分:0)
你可以这样做:
Dim result As String = String.Join(",", Col)
然后使用result
声明中的SELECT
。
除此之外,您可能应该查看参数化语句,因为它很容易被SQL注入。