title: SQL Command.ExecuteReader vb.net
body: <p>I am trying to use a login form with SQL Express 2012 and vb.net. I have the db connection, now I have the following problem;
  Incorrect syntax near '=' for the code ; data = command.ExecuteReader
  Any suggestions? Here is the code
  Thanks!!!!!!!</p>
  
  <pre><code>Imports System.Data.SqlClient
  Imports System.Data.OleDb
  
  
  Public Class login
  Private Sub login_user_Click(sender As Object, e As EventArgs) Handles login_user.Click
      Dim conn As New SqlConnection
      If conn.State = ConnectionState.Closed Then
          conn.ConnectionString = ("Server=192.168.0.2;Database=Sunshinetix;User=sa;Password=sunshine;")
      End If
  
      Try
          conn.Open()
          Dim sqlquery As String = "SELECT = FROM Users Where Username = '" &amp; username_user.Text &amp; "';"
          Dim data As SqlDataReader
          Dim adapter As New SqlDataAdapter
          Dim command As New SqlCommand
          command.CommandText = sqlquery
          command.Connection = conn
          adapter.SelectCommand = command
          data = command.ExecuteReader()
          While data.Read
              If data.HasRows = True Then
                  If data(2).ToString = password_user.Text Then
                      MsgBox("Sucsess")
                  Else
                      MsgBox("Login Failed! Please try again or contact support")
                  End If
              Else
                  MsgBox("Login Failed! Please try again or contact support")
              End If
          End While
      Catch ex As Exception
  
      End Try
  End Sub
  </code></pre>
  
  <p>End Class</p>