如何使用表

时间:2016-11-10 09:15:48

标签: vb.net

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是一个数组,包含所需列的名称

有没有办法选择列数组而没有输入数组的每个成员?

1 个答案:

答案 0 :(得分:0)

你可以这样做:

Dim result As String = String.Join(",", Col)

然后使用result声明中的SELECT

除此之外,您可能应该查看参数化语句,因为它很容易被SQL注入。