title: The parameterized query expects the parameter which was not supplied
body: <p>I'm having a problem with my code:</p>
  
  <pre><code>Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged
      list.Items.Clear()
  
      cmd.CommandText = "SELECT * FROM borrow where (Department LIKE '%" &amp; TextBox2.Text &amp; "%')"
      cmd.Connection = con
      cmd.CommandType = CommandType.Text
      con.Open()
  
  
      rd = cmd.ExecuteReader()
      If rd.HasRows = True Then
          While rd.Read()
  
              Dim listview As New ListViewItem
  
              listview.Text = rd("ID").ToString
              listview.SubItems.Add(rd("Department").ToString)
              listview.SubItems.Add(rd("Purpose").ToString)
              listview.SubItems.Add(rd("Items_Details").ToString)
              listview.SubItems.Add(rd("Requested_by").ToString)
              listview.SubItems.Add(rd("Approved_by").ToString)
              listview.SubItems.Add(rd("Date").ToString)
              listview.SubItems.Add(rd("Status").ToString)
              listview.SubItems.Add(rd("Date_Returned").ToString)
  
              list.Items.Add(listview)
  
          End While
      End If
      con.Close()
  </code></pre>
  
  <p>Once I typed in the string in the textbox to search for an item I get this error: </p>
  
  <blockquote>
    <p>The parameterized query '(@Parameter1 nvarchar(4000))SELECT * FROM
    borrow where (Departme' expects the parameter '@Parameter1', which was
    not supplied.</p>
  </blockquote>
  
  <p>Can anyone help me?</p>