whatz wrong in this SELECt query of MSSQL... ?

Posted by user522211 on Stack Overflow See other posts from Stack Overflow or by user522211
Published on 2010-12-30T06:34:05Z Indexed on 2010/12/30 6:54 UTC
Read the original article Hit count: 195

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 Date =" & TextBox1.Text & "'", SQLData)

        SQLData.Open()
        Dim dtrReader As System.Data.SqlClient.SqlDataReader = cmdSelect.ExecuteReader()
        While dtrReader.Read()
            For j As Integer = 1 To 31
                Dim s As String = "s" & j
                If dtrReader(s.ToString()).ToString() = "b" Then
                    Dim img As ImageButton = DirectCast(Panel1.FindControl(s.ToString()), ImageButton)
                    img.ImageUrl = "~/Images/booked.gif"

                    img.Enabled = False

                End If
            Next
        End While

        dtrReader.Close()
        SQLData.Close()
    End Sub

SHOWS AN ERROR :

Unclosed quotation mark after the character string ''.

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about vb.net