开发者

What's wrong in this SELECT statement

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    Dim SQLData As New System.Data.SqlClient.SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True")
    Dim cmdSelect As New System.Data.SqlClient.SqlCommand("SELECT * FROM Table1 WHERE Seats ='" & TextBox1.Text & "'", SQLData)

    SQLData.Open()

    Using adapter As New SqlDataAdapter(cmdSelect)
    Using table As New Data.DataTable()
        adapter.Fill(table)
        TextBox1.Text = [String].Join(开发者_JS百科", ", table.AsEnumerable().[Select](Function(r) r.Field(Of Integer)("seat_select")))
    End Using
    End Using

    SQLData.Close()
End Sub

This line will be highlighted with blue line:

TextBox1.Text = [String].Join(", ", table.AsEnumerable().[Select](Function(r) r.Field(Of Integer)("seat_select")))


try changing your code to

TextBox1.Text = String.Join(", ", table.AsEnumerable().Select(Function(r) r.Field(Of Integer)("seat_select")).ToArray()

hope this helps

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜