What's wrong in this SELECT statement

Posted by user522211 on Stack Overflow See other posts from Stack Overflow or by user522211
Published on 2010-12-30T08:46:34Z Indexed on 2010/12/30 9:54 UTC
Read the original article Hit count: 211

Filed under:
|
|
|
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(", ", 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")))

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about sql