Maged Algaafary Maged Algaafary - 5 months ago 53 Question

how to use select (col array())from table

Public Overloads Function SETData(Table As Tables, Col() As String) As Statuez
Dim DD As New DataSet, State As New Statuez
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 is an array holds the names of columns needed

Is there any way to select column array with out typing every member of the array ?

Ric Ric

You can do this:

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

then use the result in the SELECT statement.

Aside from this, perhaps you should look at parameterizing your statements as it is vulnerable to sql injection.