Programming for Everybody: incorrect syntax near '=' ASP.net

incorrect syntax near '=' ASP.net




objconnectionins1 = New SqlConnection("Data Source=.\;Initial Catalog=format1;Integrated Security=True")
                objconnectionins1.Open()

                Dim strsql As String
        strsql = " select * from table1  where id=" + textbox1.Text + ""
                Dim objcommand As New SqlCommand(strsql, objconnectionins1)

                myreader = objcommand.ExecuteReader()
                myreader.Read()

        lblDisplay.Text = myreader("content1")
               

        label2.Text = myreader("content")
       


        objconnectionins1.Close()
        lblDisplay.Visible = True

Solution

objconnectionins1 = New SqlConnection("Data Source=.\;Initial Catalog=format1;Integrated Security=True")
                objconnectionins1.Open()

                Dim strsql As String
        strsql = " select * from table1  where id='" + textbox1.Text + "'"
                Dim objcommand As New SqlCommand(strsql, objconnectionins1)

                myreader = objcommand.ExecuteReader()
                myreader.Read()

        lblDisplay.Text = myreader("content1")
               

        label2.Text = myreader("content")
       


        objconnectionins1.Close()
        lblDisplay.Visible = True




    End Sub

No comments:

Post a Comment