title: How to fix error "SQLexception was unhandled by user code incorrect syntax near 'FROM'
body: <p>Anyone can help me on where the 'FROM' error is would be greatly</p>
  
  <p>Here my code vb is problem</p>
  
  <pre><code>Imports System.Data
  Imports System.Data.SqlClient
  
  Private Sub ButtonOK_Click() Handles ButtonOK.Click
  
      sql = "SELECT Drug.DrugID, Drug.DrugName, Categories.CategoryName, " &amp; _
              "Suppliers.CompanyName, Drug.UnitPrice, Drug.UnitsInstock, " &amp; _
            "FROM Drug " &amp; _
              "LEFT JOIN Categories " &amp; _
                  "ON (Drug.CategoryID = Categories.CategoryID) " &amp; _
              "LEFT JOIN Suppliers " &amp; _
                  "ON (Drug.SupplierID = Suppliers.SupplierID) " &amp; _
              "WHERE Drug.ExpireDate BETWEEN @dt1 AND @dt2"
      command = New SqlCommand(sql, connection)
  
      Dim dt1 As String = GetDateTime(DateTimePicker1)
      Dim dt2 As String = GetDateTime(DateTimePicker2)
      command.Parameters.AddWithValue("dt1", dt1)
      command.Parameters.AddWithValue("dt2", dt2)
  
      adapter = New SqlDataAdapter(command)
      dataSt = New DataSet()
      adapter.Fill(dataSt, "expire")
  
      DataGridView1.DataSource = dataSt.Tables("expire")
  
      DataGridView1.RowsDefaultCellStyle.BackColor = Color.White
      DataGridView1.AlternatingRowsDefaultCellStyle.BackColor = _
          Color.PowderBlue
  
      For i = 0 To headerText.Length - 1
          DataGridView1.Columns(i).HeaderText = headerText(i)
      Next
  
      ButtonToExcel.Enabled = True
  
  End Sub
  </code></pre>
  
  <p>Here's the error:</p>
  
  <blockquote>
    <p>Incorrect syntax near the keyword 'FROM'.</p>
  </blockquote>